hi have been racking brain hours, did research online nobody seems have answer. emulator running code no problem ran again , "session 'mainactivity': error". looked through main activity 10 times there no error sign anywhere , looks should working fine, mean working before no problem. i'm not sure if there problem don't see android studio not pointing out or if different problem together.
any appreciated. thank you.
package tekvision.codedecrypter; import android.content.context; import android.content.intent; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.view; import android.view.windowmanager; import android.widget.button; import android.widget.toast; import gameinfo.gamedatabase; public class mainactivity extends actionbaractivity { //runs before application created private button mcampaignbutton; private final context context = this; //when application created @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //instantiate gamedatabase object (this activity) final gamedatabase gdb = new gamedatabase(context); gdb.fillgamedatabase(); //keeps screen on doesn't fall asleep getwindow().addflags(windowmanager.layoutparams.flag_keep_screen_on); //finding button button id after application created mcampaignbutton = (button)findviewbyid(r.id.campaignbuttonid); //checks if campaign button clicked mcampaignbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { string ans = gdb.getanswer("ancient",1); //toast pop message toast toast = toast.maketext(getapplicationcontext(), ans , toast.length_short); toast.show(); //intent go main activity campaign level select activity final intent intent = new intent(mainactivity.this, campaignselectlevel.class); startactivity(intent); } }); } }
try rebuilding , cleaning project. build > rebuild project , build > clean project
Comments
Post a Comment