i've problem asynctask. in app user must log on. 1 times, , saved login/pwd. when launch app second times, instead of display screen login , pwd edittext, want display xml there progressbar.
to that, @ if it's first authentication or not, , corresponding answer put xml. when display xml progressbar, connection server asynctask, , load need.
that works on emulator, when put app on m'y nexus s (android 2.3.3) doesn't work, i've white screen, , nothing append.
the code of activity :
public class authentificationactivity extends activity implements onclicklistener { private button btnconnection; private edittext edtusername; private edittext edtpassword; private textview lblforgottenpass; private progressbar progressbar; private textview txtprogression; private textview txtalerts; private entirepersonbm entirepersonbm = new entirepersonbm(); private string uidh = new string(); private string username = new string(); private string password = new string(); private boolean isfirstconnection = true; public static boolean isfinishapp = false; private selection selection; private selectionresultset resultset; private sharedpreferences settings; private string alerts = null; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); settings = getsharedpreferences("login", 0); isfirstconnection = settings.getboolean("isfirstconnection", true); try { if (isfirstconnection) { // put connection screen, , this.setcontentview(r.layout.login); btnconnection = (button) findviewbyid(r.id.btnconnection); edtusername = (edittext) findviewbyid(r.id.edtusername); edtpassword = (edittext) findviewbyid(r.id.edtpassword); lblforgottenpass = (textview) findviewbyid(r.id.lblforgottenpass); progressbar = (progressbar) findviewbyid(r.id.progressbar1); txtprogression = (textview) findviewbyid(r.id.textview1); txtalerts = (textview) findviewbyid(r.id.txtalerts); btnconnection.setonclicklistener(this); lblforgottenpass.setonclicklistener(this); } else { // directly connect server saved login/pwd // retrieve login/pwd this.setcontentview(r.layout.splash_login); txtprogression = (textview) findviewbyid(r.id.txtprogression); username = settings.getstring("currentusername", null); password = settings.getstring("currentpwd", null); new connectiontask().execute(""); } } } catch (exception e) { alerts .showalert(getstring(r.string.alertserroroccured), this, true); } } public void connect(sharedpreferences settings) { string login = settings.getstring("currentusername", null); string pwd = settings.getstring("currentpwd", null); log.v("retrieve user", "always log >>> login = " + login); // call server authentificationservletcall auth = new authentificationservletcall(); try { entirepersonbm = auth.authentification("booztermobile", login, pwd, "passwordhash"); log.v("call server", "connecting >>> ok"); } catch (exception e) { log.v("call server", "connecting >>> error :" + e); e.printstacktrace(); } } public void loadmail() { selection = callsutils.loadingselection(usercontroler.getinstance() .getuidh(), "new", null, string .valueof(booztermobileconstants.max_values_suggestion), "desc"); if (selection != null) { resultset = callsutils.loadingmaillist(usercontroler.getinstance() .getuidh(), selection, string.valueof(1)); } if (selection != null && resultset != null) { listheadercontroler.getinstance().setfirstauthentification(false); listheadercontroler.getinstance().setrefresh(false); listheadercontroler.getinstance().setsentmail(false); listheadercontroler.getinstance().setsplashactivty(true); listheadercontroler.getinstance().setsel(selection); listheadercontroler.getinstance().setrs(resultset); listheadercontroler.getinstance().setmailheaderlist( resultset.geteuis()); } } private class connectiontask extends asynctask<string, void, object> { protected void doinbackground(string... args) { log.v("asynctask", "start connectiontask"); connect(settings); return null; } protected void onpostexecute(object result) { // pass result data main activity txtprogression.settext(getstring(r.string.lblgetblock)); new blockloadertask().execute(""); } } private class blockloadertask extends asynctask<string, void, object> { protected void doinbackground(string... args) { log.v("asynctask", "start blockloadertask"); blockcontroler.getinstance().setlistwhere( blocksutils.generatelist(string .valueof(booztermailconstants.block_category_id), true, null)); return null; } protected void onpostexecute(object result) { // pass result data main activity txtprogression.settext(getstring(r.string.lblgetmails)); new mailloadertask().execute(""); } } private class mailloadertask extends asynctask<string, void, object> { protected void doinbackground(string... args) { log.v("asynctask", "start blockloadertask"); loadmail(); return null; } protected void onpostexecute(object result) { // create intent intent defineintent = new intent(authentificationactivity.this, headermaildisplayactivity.class); // object allows pass mail's seqnums , person's uidh // onto headermail activity bundle objetbunble = new bundle(); objetbunble.putstring("positionlist", string.valueof(1)); defineintent.putextras(objetbunble); // call headermail activity authentificationactivity.this.startactivity(defineintent); } } }
please me, try many method, nothing works, , given hope of doing want
i found device android 2.1, , works fine. there not compatible android 2.3 ?
Comments
Post a Comment