public class feedback extends activitygroup { protected static localactivitymanager mlocalactivitymanager; private edittext fd=null; private button send=null; public int res_flag=0; public string result=""; public string url=""; private relativelayout newaccount; private textview needhelp=null; private string currentdateandtime=""; private boolean isonline; protected string fd_text=""; public void replacecontentview(string id, intent newintent) { view view = getlocalactivitymanager().startactivity(id,newintent.addflags(intent.flag_activity_clear_top)) .getdecorview(); this.setcontentview(view); } @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.feedback); initialization(); try{ simpledateformat sdf = new simpledateformat("yyyy-mm-dd hh:mm:ss"); currentdateandtime = sdf.format(new date()); }catch (exception e) { system.out.println(e); } send.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { new feedback.retrieve().execute(); } }); } private void initialization() { fd=(edittext)findviewbyid(r.id.fd); send=(button)findviewbyid(r.id.send); } class retrieve extends asynctask<void, integer, integer> { progressdialog pd = null; @override protected void onpreexecute() { // todo auto-generated method stub super.onpreexecute(); pd = new progressdialog(feedback.this); pd.setmessage("please wait while sending feedback.."); pd.setcancelable(false); pd.show(); } @override protected integer doinbackground(void... params) { try{ system.out.println("in bkgrnd"); strictmode.threadpolicy policy1 = new strictmode.threadpolicy.builder().permitall().build(); strictmode.setthreadpolicy(policy1); url="url"+fd_text.tostring().trim()+"&datetime="+currentdateandtime; url=url.replace(" ","%20"); url=url.replace("+","%2b"); system.out.println(url); jsonobject json = jsonfunctions.getjsonfromurl(url); jsonobject response1=json.getjsonobject("response"); result=response1.getstring("success").tostring().trim(); system.out.println(result); if(result.equalsignorecase("1")) { system.out.println("logged in"); res_flag=1; } else { system.out.println("failed"); res_flag=5; } } catch (jsonexception e) { system.out.println(e); }catch (exception e) { system.out.println(e); } return null; } @override protected void onpostexecute(integer result) { super.onpostexecute(result); pd.dismiss();
}
error is: android.view.windowmanager$badtokenexception: unable add window -- token android.app.localactivitymanager$localactivityrecord@40e16110 not valid; activity running?
problem
i calling activity through tabhost.,it loading view .the webservice , button not working ., when click buttons shows above error.help me proceed guys..
reference: http://www.gamma-point.com/content/android-how-have-multiple-activities-under-single-tab-tabactivity
now activitygroup deprecated.., should use now..
for have posted, doesn't seem need use activitygroup
@ all. extend feedback
activity
class. example:
public class feedback extends activity
Comments
Post a Comment