In the onclick () Click event
Upload Location
Case R.ID.PERSON_UP_LOCAT:
System.out.println ("= = = output ....) ====");
StartActivity (New Intent (Personcenteractivity.this,
Addedtoolsactivity.class));
Get geolocation-latitude and longitude and coordinates
String addrstr = Sharedata.getsharestringdata ("Addrstr");
String latit = Sharedata.getsharestringdata ("Latit");
String longit = Sharedata.getsharestringdata ("Longit");
String Urlloca = Httpurl.httplipei
+ "/yqw/w/c/post?app=survey&mdl=web&act=getsurveylonlatlist"
+ "&type=json&token=1";
+ "&col.surveyid=" + Surveyid
Urllo = Urlloca + "&col.lon=" + longit + "&col.lat=" + latit
+ "&col.addressinfo=" + addrstr;
System.out.println ("= = = output ....) ==2== ");
Final String Locationlla = Httpservice.postparamandfile (Urllo);
Mtime.schedule (New Remindtask (), 100, 3000);
Final Timer mtime = new timer ();
TimerTask Mtask;
Mtime.schedule (New TimerTask () {
@Override
public void Run () {
try {
System.out.println ("=flag=0=" + FLAG);
Mtime.schedule (Mtask, 100, 1000);//
Execute task after 0.1s and execute again after 1s
System.out.println ("Upload location-------11--");
Using the Do,while method, do---Start the thread, upload the data
do {
Locationlla = Httpservice.postparamandfile (Urllo);
System.out.println ("Upload location-------33--" + Urllo
+ "= = =" + Locationlla);
} while (FLAG = = 1);
while (FLAG = = 1); ---Stop shutting down the thread and closing the data
Mtime.cancel ();
System.out.println ("Do not upload geographic location-------22--");
} catch (Exception e) {
TODO auto-generated Catch block
E.printstacktrace ();
}
}
} , (+);
System.out.println ("=flag=1=" + FLAG);
if (FLAG = = 0) {
First_visib.setvisibility (View.gone);
First_gone.setvisibility (view.visible);
FLAG = 1;
System.out.println ("===00====0======");
} else if (FLAG = = 1) {
System.out.println ("===0===2======");
First_visib.setvisibility (view.visible);
First_gone.setvisibility (View.gone);
FLAG = 0;
System.out.println ("Do not upload geographic location-----00--22--");
}
System.out.println ("=flag=2=" + FLAG);
Break
Default
Break
Android thread start and stop (learn Java technology)