java - App randomly crashing, MainActivity session error occurs -
sometimes application run slow , messes up. attached main activity , manifest, think 1 of making application mess up. gives me error : session 'mainactivity': error.
any appreciated.
thank you.
main activity
import graphics.myglsurfaceview; import gameinfo.gamedatabase; public class mainactivity extends actionbaractivity { //runs before application created private button mcampaignbutton; private context context = this; private glsurfaceview mglview; //when application created @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //new thread perform database creation / filling runnable runnable = new runnable(){ public void run(){ //instantiate gamedatabase object (this activity) final gamedatabase gdb = new gamedatabase(context); gdb.fillgamedatabase(); } }; thread mythread = new thread(runnable); mythread.start(); mglview = new myglsurfaceview(this); setcontentview(mglview); //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) { //intent go main activity campaign level select activity final intent intent = new intent(mainactivity.this, campaignselectlevel.class); startactivity(intent); } }); } }
android manifest
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tekvision.codedecrypter"> <!-- tell system app requires opengl es 2.0. --> <uses-feature android:glesversion="0x00020000" android:required="true" /> <supports-gl-texture android:name="gl_oes_compressed_etc1_rgb8_texture" /> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".campaignselectlevel" android:label="@string/title_activity_campaign_select_level" > </activity> <!-- anagrams.modern era java class different package--> <activity android:name="anagrams.modern_era" android:label="modern_era"> </activity> </application>
make sure declaring permissions in manifest file required application i.e.
<uses-permission android:name="android.permission.write_external_storage"/>
for more details check this: uses-permission
Comments
Post a Comment