java - ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) - where is the error? -


i have little problem project. every time use

btnlinktocreatesession.setonclicklistener(new view.onclicklistener() {          public void onclick(view view) {             intent = new intent(getapplicationcontext(),                    createsessionactivity.class);             startactivity(i);             finish();         }     }); 

the error appears:

"activitythread.performlaunchactivity(activitythread$activityclientrecord, intent)"

when take out, works, again. there fault in code, or must error somewhere else?

 btnlinktocreatesession.setonclicklistener(new view.onclicklistener() {          public void onclick(view view) {             intent = new intent(getapplicationcontext(),                    createsessionactivity.class);             startactivity(i);             finish();         }     });      // link register screen     btnlinktoregister.setonclicklistener(new view.onclicklistener() {          public void onclick(view view) {             intent j = new intent(getapplicationcontext(),                 registeractivity.class);             startactivity(j);             finish();         }     }); 

edit: + createsessionactivity.java

package com.game;  import org.json.jsonexception; import org.json.jsonobject;    import com.game.library.databasehandler; import com.game.library.userfunctions;   import android.app.activity;  import android.content.intent;  import android.os.bundle;  import android.util.log;  import android.view.view;  import android.widget.button;  import android.widget.edittext;       import android.widget.textview;   public class createsessionactivity extends activity { button btncreatesession; button btnlinktologin; edittext inputnameofsession; edittext inputusermax; edittext inputbetamount; textview createsessionerrormsg;  // json response node names private static string key_success = "success"; private static string key_error = "error"; private static string key_error_msg = "error_msg"; private static string key_sid = "sid"; private static string key_sname = "sname"; private static string key_smax = "smax"; private static string key_sbet = "sbet"; private static string key_created_at = "created_at";  @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.session);      // importing assets buttons, text fields     inputnameofsession = (edittext) findviewbyid(r.id.sessionname);     inputusermax = (edittext) findviewbyid(r.id.sessionmax);     inputbetamount = (edittext) findviewbyid(r.id.sessionbet);     btncreatesession = (button) findviewbyid(r.id.btncreatesession);     btnlinktologin = (button) findviewbyid(r.id.btnlinktologinscreen);     createsessionerrormsg = (textview) findviewbyid(r.id.session_error);      // register button click event     btncreatesession.setonclicklistener(new view.onclicklistener() {                     public void onclick(view view) {             string sname = inputnameofsession.gettext().tostring();             string smax = inputusermax.gettext().tostring();             string sbet = inputbetamount.gettext().tostring();              userfunctions userfunction = new userfunctions();             jsonobject json = userfunction.opensession(sname, smax,      sbet);              // check login response             try {                 if (json.getstring(key_success) != null) {                     createsessionerrormsg.settext("");                     string res = json.getstring(key_success);                      if(integer.parseint(res) == 1){                         // user registred                         // store user details in sqlite      database                         databasehandler db = new databasehandler(getapplicationcontext());                         jsonobject json_session_u = json.getjsonobject("session");                          // clear previous data in database                         userfunction.logoutsession(getapplicationcontext());                         db.addsession(json_session_u.getstring(key_sname), json_session_u.getstring(key_smax), json.getstring(key_sbet), json_session_u.getstring(key_created_at));                                              // launch dashboard screen                         intent dashboard = new intent(getapplicationcontext(), dashboardactivity.class);                         // close views before launching      dashboard                         dashboard.addflags(intent.flag_activity_clear_top);                         startactivity(dashboard);                         // close registration screen                         finish();                     }else{                         // error in registration                         createsessionerrormsg.settext("error occured in registration");                     }                 }             } catch (jsonexception e) {                 e.printstacktrace();             }         }     });      // link login screen     btnlinktologin.setonclicklistener(new view.onclicklistener() {          public void onclick(view view) {             intent = new intent(getapplicationcontext(),                     loginactivity.class);             startactivity(i);             // close registration view             finish();         }     }); } 

}

i had trouble inserting logcat here thatswhy:

http://androidprojekt.esy.es/android_login_api/loggo.txt

#

i think solved - works

    inputemail = (edittext) findviewbyid(r.id.loginemail);     inputpassword = (edittext) findviewbyid(r.id.loginpassword);     btnlogin = (button) findviewbyid(r.id.btnlogin);     btnlinktoregister = (button) findviewbyid(r.id.btnlinktoregisterscreen);     /* had forgotten add this: */     btnlinktocreatesession = (button) findviewbyid(r.id.btnlinktocreatesession);     loginerrormsg = (textview) findviewbyid(r.id.login_error); 

you should use activity's context instead of getapplicationcontext() start activities. change intents use start activity this:

intent dashboard = new intent(youractivity.this, dashboardactivity.class); 

you should read this post deeper insight.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -