How To Do Two Operations From A Single Click Of A Button In Android
hi i have created an app. I already have a coding to find the latitude and longitude of a place. But in that coding i have button and when the button is clicked the values get disp
Solution 1:
You don't need AsyncTask. You just have to update your views with information you obtain in loadCoords();
.
Try something like:
Coordscoords= loadCoords();
super.onCreate(savedInstanceState);
setContentView(R.layout.add);
t1 = (TextView) findViewById(R.id.t1);
t1.setText(coords.getLatitude());
P.S. Just a point: Java Convention advices you to name methods in Camel Case, like this: loadCoords() - the first letter is always small.
Solution 2:
You can use a Toast
message to display the latitude and longitude, and then should open another activity.The Toast
will remain visible for a particular time, and you'll also get your activity opened.
Post a Comment for "How To Do Two Operations From A Single Click Of A Button In Android"