My requirement is to achieve this in LinearLayout. It is having only one child view. In horizontal orientation, a button needs to be at center horizontal, if layout_gravity is set. my layout xml is

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="200dp"
android:background="#ffff00"
android:layout_width="match_parent"
android:orientation="horizontal">

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:text="Button" />

</LinearLayout>

But the result is like below image

enter image description here

What i am expecting is, when the layout_gravity is set to center_horizontal , the button center to the horizontal. Why this is not working

I wants to ask that suppose i wants to make a view like as given below image

Now i wants to know is it efficient to have a custom list-view for this or a simple linear layout with elements which can be inflated and added to another layout, as i do not wants to have any click operation over the items , i just need to show them over a screen. which one will be better approach?

I already know how to make Custom ListViews

enter image description here

In my android app I need to check whether a particular view is focussed. Now I found the getCurrentFocus() function in Activity class but this returns a View Object.

How can I compare and check whether this returned View is same as the one in question. I mean there is no getName() function here. So after getting the View object, how can I compare to check which View class is this ?

I've got a problem with fragmentactivity and onCreate method. My classes looks like this:

public abstract class B extends FragmentActivity implements View.OnKeyListener
{}

public class A extends B

{
    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        // stuff
    }
}

OnCreate in class A is not called. I created layout from another after click and onCreate is in second layout. I don't know where is the problem.

So I have created a button in my layout, but I wanted it to be a circle. So I created an .xml drawable like this -

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid android:color="#673ab7"/>
    <stroke android:width="2sp" android:color="#fff" />
</shape>

Then in the button bit in the layout i added this - android:background="@drawable/circle_button" But now I wish to have an image inside the circler button. How can I achieve this? Can I simply add something in the drawable xml?

I've tried searching for answers but I am confused to what I should search for.

My App is ready for Alpha and later, Beta testing. Up until now for testing my Google Play Leaderboards, I used the standard debug.keystore.

Now, I'm ready to upload my APK for the first time to the Play Store for my test groups. I've therefore signed the APK with my own private key.

So when I install the app from my exported APK, I now cannot connect to Google Play Service to access the leaderboards (expected behavior).

I looked around on SO and I saw a question which suggested that I needed to sign my test APK with my own key and this must be the same key that the final production APK will use.

  • Question - Is this correct? Does my Alpha / Beta and Production APK's have to be signed using the same keystore?

Someone also mentioned that you can add private keystore details to your project in the Developers Console

  • Is this correct? I've looked but I can't see where to do this?!

And, on this page, it states the following:

Important: When you prepare to release your app to your users, you must follow these steps again and create a new OAuth 2.0 client ID for your production app. For production apps, you will use your own private key to sign the production app's .apk file. See Signing your applications for more information.

This seems to suggest that the first point above isn't correct? i.e. I can use a debug keystore when I upload APK's for Alpha / Beta testing, but for 'production apps' - which I read as 'final ready to go / post testing' - apps need to have a private key, therefore, not the same as test APK's.

  • Is the above correct and true for my leaderboard situation?

I find it a bit confusing, so I may have misunderstood some of the things I've read, but would be grateful if someone could clear up my confusion!

I have a custom class which extends AlertDialog. I would like to create a dialog with which I can control the width, height, x, and y positions programmatically. Here is what I currently have:

MyDialog md = new MyDialog(context, AlertDialog.THEME_HOLO_LIGHT);
//md.setMessage("");
md.show();
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(md.getWindow().getAttributes());
lp.x = 100;
lp.y = 400;
lp.width = 200;
lp.height = 400;
md.getWindow().setAttributes(lp);

If I remove the setMessage line, no dialog is displayed. If I leave it in though it will show a blank dialog that acts strangely:

  1. The height of the dialog seems locked in to the height of a single line of text rather than using the height value that is set.

  2. The dialog APPEARS to be one line tall, however, it does not allow it to go any lower on the screen than the set height would allow. A dialog positions itself on screen to ensure that all of it is always visible, which is why this occurs.

Also, if I add a lot of text to the setMessage method the dialog will stretch to contain all of it, is there a way to set it so that it crops whatever does not fit?

In summary: It appears that alert dialog does quite a bit behind the scenes in terms of formatting that I would like to disable. Is there a better way to format a dialog? The solution to this problem MUST use Dialog as a base class. Thanks in advance.

I'm a newie using Retrofit, and I was seraching for a automatic way to generate the class types for consume a rest web service with retrifit becouse as far as I've seen I'm suposed map all the objects that returns the server.

Specifically I want to work with a Endpoint Django REST framework 2.3.14 with a lot of elements by each method, Thats why I want to generate in an automatic way the element types.

I've seen some with JAX-RS but I'm not sure it works with django Rest Services.

Any help would be very appreciated. Thanks

In my App I have:

  • DataManager class - a singleton which holds data
  • Activity which shows a 'loading' fragment until the data is ready, and then once it is ready, it replaces it with a 'content' fragment. (I do this with the replace() method, since I no longer have use for the 'loading' fragment)

The following flow causes (sometimes) a null pointer exception:

  • Open app and wait for the data to be loaded (meaning, until we get to the 'content' fragment)
  • leave the app using the home button
  • open the app after a while (after Android kills the app)

What happens is that the app resumes to the 'content' fragment, but the data from the DataManager is null. This happens because Android kills my app, but when I resume, it saves the state, meaning it shows the 'content' fragment automatically.

Is there a way for me to tell the app not to create the 'content' fragment in this scenario? The solution I currently have in mind is to create a 'loading' Activity instead of a fragment, but i'd like to avoid that.

I've been scratching my head for a few days and I hope someone can help me out. I'm trying to implement leaderboards in my game and I can't figure out what I'm doing wrong! When my game starts up, I see the "Connecting to Google Play Games" screen load up and then I'm able click the "sign in" button.

After that I get a message saying "Unknown issue with Google Play Service". I went through the documentation and a few tutorials but still can't figure out what is wrong.

Here is my code:

public class AndroidLauncher extends AndroidApplication implements GameInterface, GameHelper.GameHelperListener {

    protected RelativeLayout layout;
    protected GameHelper gameHelper;

    @Override
    public void onCreate (Bundle savedInstanceState) {
        gameHelper = new GameHelper(this, GameHelper.CLIENT_GAMES);
        gameHelper.enableDebugLog(true, "GameHelper");

        super.onCreate(savedInstanceState);
        AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();

         // Create the layout
        layout = new RelativeLayout(this);

        // Do the stuff that initialize() would do for you
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

        // Create the libgdx View
        View gameView = initializeForView(new BirdBlast(this), config);

        layout.addView(gameView);

        gameHelper.setup(this);

        // Hook it all up
        setContentView(layout);

        if(!gameHelper.isSignedIn()) {
            gameHelper.beginUserInitiatedSignIn();
        }

    }


    @Override
    public void onActivityResult(int request, int response, Intent data) {
        super.onActivityResult(request, response, data);
        gameHelper.onActivityResult(request, response, data);
    }

    @Override
    public void onSignInFailed() {
        System.out.println("TEST: " + gameHelper.isSignedIn());
    }

    @Override
    public void onSignInSucceeded() {
        System.out.println("TEST: " + gameHelper.isSignedIn());
    }
}

Here is my logcat output:

07-14 19:19:43.920  25791-25791/com.mypackage.mygame D/GameHelper﹕ GameHelper: onActivityResult: req=RC_RESOLVE, resp=RESULT_OK
07-14 19:19:43.920  25791-25791/com.mypackage.mygame D/GameHelper﹕ GameHelper: onAR: Resolution was RESULT_OK, so connecting current client again.
07-14 19:19:43.920  25791-25791/com.mypackage.mygame D/GameHelper﹕ GameHelper: Starting connection.
07-14 19:19:44.871  25791-25791/com.mypackage.mygame D/GameHelper﹕ GameHelper: onConnectionFailed
07-14 19:19:44.871  25791-25791/com.mypackage.mygame D/GameHelper﹕ GameHelper: Connection failure:
07-14 19:19:44.871  25791-25791/com.mypackage.mygame D/GameHelper﹕ GameHelper:    - code: INTERNAL_ERROR(8)
07-14 19:19:44.871  25791-25791/com.mypackage.mygame D/GameHelper﹕ GameHelper:    - resolvable: false
07-14 19:19:44.871  25791-25791/com.mypackage.mygame D/GameHelper﹕ GameHelper:    - details: ConnectionResult{statusCode=INTERNAL_ERROR, resolution=null}
07-14 19:19:44.871  25791-25791/com.mypackage.mygame D/GameHelper﹕ GameHelper: onConnectionFailed: WILL resolve because user initiated sign-in.
07-14 19:19:44.871  25791-25791/com.mypackage.mygame D/GameHelper﹕ GameHelper: onConnectionFailed: resolving problem...
07-14 19:19:44.871  25791-25791/com.mypackage.mygame D/GameHelper﹕ GameHelper: resolveConnectionResult: trying to resolve result: ConnectionResult{statusCode=INTERNAL_ERROR, resolution=null}
07-14 19:19:44.871  25791-25791/com.mypackage.mygame D/GameHelper﹕ GameHelper: resolveConnectionResult: result has no resolution. Giving up.
07-14 19:19:44.871  25791-25791/com.mypackage.mygame W/GameHelper﹕ disconnect() called when client was already disconnected.
07-14 19:19:44.911  25791-25791/com.mypackage.mygame D/GameHelper﹕ GameHelper: Notifying LISTENER of sign-in FAILURE (error)

I am working on a simple mobile app that controls the camera from phone. I am interested to take pictures with custom shutter speed. UP to 30 second exposures are easily controlled by setting the shutter speed via API, however longer exposures require use of BULB mode.

Is there way take a picture with BULB mode from the Camera Remote API?

This seems to be a blocker for some use cases i.e. extended bracketing and some weird forms of time-lapse that I want to shoot.

PS I am struggling with few more topics - setting metering mode (spot, center, multi), setting white balance tint (green - purple axis as opposed to temperature yellow - blue). Is there way to control these parameters?

I'm integrating an Android app with our web experience and I'm finding a couple ways to launch my app with a given parameter foo via a link:

  1. <a href="intent://#Intent;package=com.example.app;S.foo=bar;end">click me</a>

  2. <a href="http://www.dummy.com/page.htm?foo=bar">click me</a>

and then in the manifest define an intent-filter

<intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data
        android:host="www.dummy.com"
        android:pathPrefix="/page.htm"
        android:scheme="http" />
</intent-filter>

Example 1 will automatically launch the app in the marketplace if it is not already installed.

Example 2 I need to actually have a placeholder page page.htm to manage the not installed scenario.

Both will potentially work for my needs, both have their advantages and disadvantages, but is there a preferred/supported method? I'd hate to use an unsupported method that ends up failing to work in the future.

In my activity using tab for action bar, but what I try to do is when I'm in one of the options my tab, have a button in that fragment and click go to another activity, but I have an error on my Intent on which tells me that is not defined.

Someone can help me?

Thank you very much.

package com.example.dona1click;

import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;


public class Nosotros extends Fragment {
    Button Btn;
    Intent intent;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View x = inflater.inflate(R.layout.nosotros, container, false);

        Btn = (Button)x.findViewById(R.id.button1);

        Btn.setOnClickListener(new OnClickListener() { // evento clic del boton

            @Override
            public void onClick(View v) {

                // al hacer clic se manda para la otra pagina


                intent = new Intent (this, MainActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);             
                startActivity(intent);

                //---------------------------------------------


            }

        }); 

        return x;
    }
}

I'm having a somewhat strange problem. I created an ExpandableListView, an Adapter for it, and two objects to hold the data. The problem is that when I assign a v.onChildClickListener and then try to change the background color of the TextView it changes the background on several of them.

Here's the List header:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical">

    <TextView
        android:id="@+id/list_header"
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
        android:textSize="18dp"
        android:textColor="@android:color/black"
        android:background="@drawable/abc_ab_solid_light_holo"
        android:typeface="normal"
        android:textAlignment="center"
        android:layout_gravity="center_vertical" />



</LinearLayout>

Here's the List Item:

<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:weightSum="1"
    >


    <TextView android:id="@+id/end_trip_item_address"
        android:layout_width="230dp"
        android:layout_height="wrap_content"
        android:text="Sample Data"
        android:textSize="15sp"
        android:paddingBottom="5dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"

        android:paddingTop="3dp"
        android:paddingLeft="2dp"
        />

    <TextView android:id="@+id/end_trip_date_time"
        android:layout_width="230dp"
        android:layout_height="wrap_content"
        android:text="Sample Data 2"
        android:textSize="15sp"
        android:paddingBottom="4dp"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/end_trip_item_address"
        android:layout_alignParentLeft="true"

        android:paddingLeft="2dp" />

</GridLayout>

Here's the List Group container object:

public class ExpandListGroup {
    private String name;
    private ArrayList<ExpandListChild> items;
    private int group_id = -1;

    public ExpandListGroup(int group_id) {
        this.group_id = group_id;
        items = new ArrayList<ExpandListChild>();
    }


    public String getName() {
        return name;
    }

    public int getGroupId() {
        return group_id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ArrayList<ExpandListChild> getItems() {
        return items;
    }

    public void addItem(ExpandListChild item) {
        items.add(item);
    }


    public void reverseChildren() {
        Collections.reverse(items);
    }
}

Here's the List Item Object:

public class ExpandListChild {

    private String date = null;
    private long millis = -1;
    private int id = -1;
    private double distance = -1;
    private int tripKey = -1;
    private double lat = -1;
    private double lon = -1;
    private int businessRelated = -1;
    private String address = null;

    public ExpandListChild(String date, long millis, int id, double distance, int tripKey, double lat, double lon, int businessRelated, String address) {
        this.date = date;
        this.millis = millis;
        this.id = id;
        this.distance = distance;
        this.tripKey = tripKey;
        this.lat = lat;
        this.lon = lon;
        this.businessRelated = businessRelated;
        this.address = address;
    }


    public String getDate() {
        return date;
    }

    public int getId() {
        return id;
    }

    public double getDistance() {
        return distance;
    }

    public int getTripKey() {
        return tripKey;
    }

    public double getLat() {
        return lat;
    }

    public double getLon() {
        return lon;
    }

    public int isBusinessRelated() {
        return businessRelated;
    }

    public void setBusinessRelated(int businessRelated) {
        this.businessRelated = businessRelated;
    }


    public String getAddress() {
        return address;
    }
}

Now, here's the ListAdapter:

public class ExpandableListAdapter extends BaseExpandableListAdapter {

    private Context context;
    private ArrayList<ExpandListGroup> groups;


    public ExpandableListAdapter(Context context, ArrayList<ExpandListGroup> groups) {
        this.context = context;
        this.groups = groups;
    }


    @Override
    public int getGroupCount() {
        return this.groups.size();
    }

    @Override
    public int getChildrenCount(int groupPosition) {
        ArrayList<ExpandListChild> children = groups.get(groupPosition).getItems();
        return children.size();
    }

    @Override
    public Object getGroup(int groupPosition) {

        return groups.get(groupPosition);
    }

    @Override
    public Object getChild(int groupPosition, int childPosition) {
        ArrayList<ExpandListChild> children = groups.get(groupPosition).getItems();
        return children.get(childPosition);
    }

    @Override
    public long getGroupId(int groupPosition) {
        return groupPosition;
    }

    @Override
    public long getChildId(int groupPosition, int childPosition) {
        return childPosition;
    }

    @Override
    public boolean hasStableIds() {
        return true;
    }

    @Override
    public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
        ExpandListGroup group = (ExpandListGroup)getGroup(groupPosition);
        String headerTitle = group.getName();

        if (convertView == null) {
                LayoutInflater inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(R.layout.trip_expand_header, null);
        }

        TextView lblListHeader = (TextView) convertView
                .findViewById(R.id.list_header);
        lblListHeader.setTypeface(null, Typeface.BOLD);
        lblListHeader.setText(headerTitle);

        return convertView;
    }

    @Override
    public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {

        ExpandListChild child = (ExpandListChild)getChild(groupPosition, childPosition);

        if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(R.layout.trip_list_item, null);
        }

        TextView addressView = (TextView) convertView
                .findViewById(R.id.end_trip_item_address);

        TextView dateView = (TextView) convertView
                .findViewById(R.id.end_trip_date_time);

        addressView.setText(child.getAddress());
        dateView.setText(child.getDate());
        return convertView;
    }

    @Override
    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return true;
    }

}

Finally, here's where I set the adapter and where I try to change the background of the TextView. It's also where the weirdness happens where when I touch one item it changes the background of that item as well as what seems to be randomly changing the background of other items.

listAdapter = new ExpandableListAdapter(this, listGroups);

        expListView.setAdapter(listAdapter);

        expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
                @Override
                public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {

                    TextView text = (TextView)v.findViewById(R.id.end_trip_item_address);


                    v.setBackgroundColor(R.drawable.abc_ab_solid_light_holo);
                    return false;
                }
            }
        );

I am facing issue to discover ChromeCast devices, i need to enable Debug mode for MediaRouter.

I have not found any option on the documentationof android.support.v7.media.MediaRouter.

Is it possible?

I have been trying to explore the Evernote API - https://dev.evernote.com/doc/. When a business card is scanned in evernote, it stores the email, phone no etc. I am unable to find the calls from the API that would return back that info for me. Let me know how to return that information from an evernote note.

Thanks.

I'm not sure how I would go about declaring the timer1 instance of my subclass Timer. I'm told I need to initialize the instance but how do I do that if timer1 is a class instance and not a primitive? Here's my code:

package com.example.derpphone;



import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.SocketException;
import java.util.TimerTask;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;



public class MainActivity extends Activity implements OnClickListener{

public class Timer extends TimerTask {


DatagramSocket socket;

public Timer() throws SocketException { 
    this.socket = new DatagramSocket();
}

    @Override
    public void run() {     
        while (true){
                if (socket != null) {
                                   byte[] bytes = new byte[100];
                    SocketAddress serverAddress = new InetSocketAddress("131.179.176.74", 9998);
                    try {
                        DatagramPacket packet = new DatagramPacket(bytes,
                                bytes.length, serverAddress);
                        socket.send(packet);                    

                    } catch (Exception e) {

                    }
                }
            }
}
}
    Timer timer1;
 public MainActivity () throws SocketException{
 timer1 = new Timer();
   }

String error = "error";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);



    View callButton = findViewById(R.id.btnCall);

    callButton.setOnClickListener(this);
    ;
}



private void phoneCall()
{
   String phoneCallUri = "tel://myPhoneNumber";
   Intent phoneCallIntent = new Intent(Intent.ACTION_CALL);
   phoneCallIntent.setData(Uri.parse(phoneCallUri));
   startActivity(phoneCallIntent);
 }
 @Override 
 public void onClick(View view) {
      switch(view.getId())
      {
       case R.id.btnCall:
           timer1.run();
           phoneCall();
        break;

       case R.id.end:
           timer1.cancel();
           break;

       default:
           System.out.println(error);
        break;
      }
      }
}

I am new in android programming so i take the error of "catchable fatal error object of class stdclass could not be converted to string " from my virtual device. and the error line in php class is below. Thanks for your answers.

PHP Code:

$friendlocs= $db->getFriendsLocations($useremail);


$a=array();
$b=array();



if ($res){
while ($row = mysql_fetch_array($friendlocs))
    {
            //$b["id"] = $data[$j]->id;

            $b["f_name"] = "_";
            $b["f_email"] = $row[0];
            $b["f_lat"] = $row[1];
            $b["f_lon"] = $row[2];
            $b["f_time"] = $row[3];
            $b["f_timezone"] = $row[4];
            $b["f_synctime"] = $row[5];
            $b["f_friend_status"] = $row[6];


            array_push($a,$b);

    }
}




 print json_encode($a);

PHP function:

    public function getFriendsLocations($user_email) {
    // birden fazla row döndüreceği için ANY ifadesi kullanılarak birleştiriliyor.
        $result = mysql_query("select user_email,and_loc_lat, and_loc_long, and_loc_time, and_loc_timezone, and_sync_time, user_loc_status FROM tbl_currentlocs WHERE user_email = ANY (select DISTINCT friend_email FROM tbl_friendship WHERE user_email = '$user_email')");
    return $result;
}

Android code:

                    try {
                            JSONArray arr = new JSONArray(response);
                            System.out.println("try başladı");
                            System.out.println(arr.length());
                            for(int i=0; i<arr.length();i++){
                                System.out.println("for başladı");
                                JSONObject obj = (JSONObject)arr.get(i);
                                System.out.println(obj.get("f_name"));
                                System.out.println(obj.get("f_email"));
                                System.out.println(obj.get("f_lat"));
                                System.out.println(obj.get("f_lon"));
                                System.out.println(obj.get("f_time"));
                                System.out.println(obj.get("f_timezone"));
                                System.out.println(obj.get("f_synctime"));
                                System.out.println(obj.get("f_friend_status"));

                                     friendDb.updateFriendLocSyncStatus(obj.get("f_name").toString(), obj.get("f_email").toString(), obj.get("f_lat").toString(), obj.get("f_lon").toString(), obj.get("f_time").toString(), obj.get("f_timezone").toString(), obj.get("f_friend_status").toString(), obj.get("f_synctime").toString() );
                            }
                            Toast.makeText(getApplicationContext(), "Friend Location Sync completed!", Toast.LENGTH_LONG).show();
                        } catch (JSONException e) {
                            // TODO Auto-generated catch block
                            Toast.makeText(getApplicationContext(), "Error Occured [Server's JSON response might be invalid]!", Toast.LENGTH_LONG).show();
                            e.printStackTrace();
                        }
                    }

i'm new to java,i try to get specified value from table in my geodatabase file

this my code when i call my geodatabase file

final String extern = Environment.getExternalStorageDirectory().getPath();
final String geo_kntr = "/ArcGIS/samples/localtilelayer/routing/kontur_444.geodatabase";
        try {
            g_kontur = new Geodatabase(extern + geo_kntr);
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        gft_kontur = g_kontur.getGeodatabaseFeatureTableByLayerId(0);
        fl_kontur = new FeatureLayer(gft_kontur);
        Map.addLayer(fl_kontur);

and i confuse how to get specified value from there,i've tried to solve this but still have no clue..

i'm so sorry for my bad english

Hie guys (better yet, coders), I'v this use case :

open app > game starts with user's turn > He got to enter a country in Edittext & click on submit button before 20 seconds else num_of_faults will increase by 1 (if(num_of_faults == 3) game_over)

now semi pseudo code is :

static void Game(){
    while(true){
        getTimedInput();
        while(true){        
            if(condition 1 is false){
                num_of_faults++;
                getTimedInput();
            } else {
                continue game;          
            }
            if(num_of_faults == max_tries){
                break;
            }
        }       
        if(num_of_faults == max_tries){
            return;
        }       
    }
}

public static void getTimedInput(){
    final Thread thread=  new Thread(){
        @Override
        public void run(){
            try {
                synchronized(this){
                    wait(20000);
                }
            }
            catch(InterruptedException ex){                    
            }
        }
    };
    thread.start();

   inputSubmit.setClickable(true);
   inputSubmit.setOnClickListener(new OnClickListener() {           
        @Override
        public void onClick(View v) {
            synchronized(thread){
                thread.notifyAll();
            }
            get editText input some input validations..           

            if(condition 2 is false){ 
                inputSubmit.setClickable(false);
                inputSubmit.setOnClickListener(null);
                getTimedInput();
            } else if(condition 3 is false) {
                inputSubmit.setClickable(false);
                inputSubmit.setOnClickListener(null);
                getTimedInput();
            } else {
                continue game;
            }
        }
    });  
}

it indeed is possible duplicate of "waiting for user to click a button" on stack overflow, But i'v spent many all nighters trying to solve this, PS : can't really seem to put whole code in onClickListener, i'hd really appreciate if ne1 could really put some effort in solving abovmentioned logic, or at least give me some pointers to work upon. Thanks!

So I have an app which uses a couple of very large SDKs (such as the Amazon AWS SDK). In order to circumvent the 64k method limit on the dex file, I run proguard on both prod and debug builds of the app for it to successfully compile.

The proguard file is below:

-keep class org.w3c.dom.bootstrap.** { *; }
-keep class org.joda.time.** { *; }
-keep class com.facebook.** { *; }
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-dontwarn org.codehaus.jackson.map.ext.**

The app runs fine, and I can use Android Studio's built in debugger in order to add break points and step through the code.

However, when I do this, I've noticed that any method parameters that are normally logged in the Variables section of the debug window are not showing up. Also, any regular variable declared such as

int number = 4;

won't show up either. The only variables that do show up are class member variables.

Is there something I need to add to my proguard file in order to get the rest of these variables? Thanks!