java - Showing loading screen? -


i want show loading screen while doubles, longitude , latitude, 0. currently, dialog doesn't show, , error comes:

while(awesome.longitude == 0 && awesome.latitude == 0){              log.v(tag, "in while");              progressdialog dialog = progressdialog.show(mainactivity.this, "",                     "fetching location...please wait. if takes long, try again.", true);              dialog.show();          } 

longitude , latitude variables in class ruchirlocation, , awesome object of ruchirlocation

the while loop goes through, dialog doesn't show. then, after looping 50 times, error:

 caused by: java.lang.runtimeexception: not read input channel file descriptors parcel. 

pointing at:

        progressdialog dialog = progressdialog.show(mainactivity.this, "",                 "fetching location...please wait. if takes long, try again.", true); 

how can fix this? want show loading dialog while variables 0.

thanks,

ruchir

the proper way show dialog , value of variables dismiss progress dialog.

progressdialog pd;  if(awesome.longitude == 0 && awesome.latitude == 0){     pd = new progressdialog(//context here);     pd.setmessage("loading...")     pd.show(); } 

and value of variables -

pd.dismiss(); 

Comments