Unable to start an Activity from Application class - Android -


i trying access if user logged in or not, based on try start activity application. while doing this, app crashes in application class.

the code application class is

public class myclass extends application {     public static context context;      @override     public void oncreate() {         super.oncreate();         context = getapplicationcontext();          if(parseuser.getcurrentuser().isauthenticated()){             startactivity(new intent(context, mainactivity.class));         }      } } 

any suggestion why happens ?

in manifest have declared intent filter activity.

 <activity             android:name=".activities.register"             android:label="@string/title_activity_register" >             <intent-filter>                 <action android:name="android.intent.action.main" />                  <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity> 

intent intent = new intent(context, mainactivity.class); intent.addflags(intent.flag_activity_new_task); startactivity(intent); 

also if @ logcat in android studio, should seeing error log has told how fix issue.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -