how to do two operations from a single click of a

2019-08-27 19:50发布

问题:

I have already asked this question in SO but I have done some errors in my question so I am questioning here once again clearly.

I have a coding to find the latitude and longitude of a place, in that coding i have a button and when the button is clicked the longitude and latitude gets displayed. I am trying to use the same code in another app.

In my new app in the first page I have a button named start, when i click the button it moves over to the 2nd page.

In that 2nd page i have placed two layouts. In one layout i have placed some textview and edit text data with a ok button. In the other layout i want the values of latitude and longitude to be get displayed. the displaying of values must be done automatically when 2nd page gets opened.

the following is the code which i used in my app

public class AddRestingSpot extends Activity    
{   ImageView background, title;  TextView titletext,t1,t2,t3,t4,t5;
  public void onCreate(Bundle savedInstanceState)
    {        
     if (entered)
     {
         LoadCoords();
     }
  super.onCreate(savedInstanceState);       
  setContentView(R.layout.add);
}

public void LoadCoords() 
 {
 //here i have placed the coding for longitude values 
}

but this is not working.

if i have to use Async task ina ndroid by using threads where to implement it