java - android app crashing on startActivity() -


i have started intent , asked go main activity, when attempts app crashes.

here code tries go main activity.

intent = new intent( ".main_activity"); startactivity(i);    

here xml manifest main_activity.

<activity     android:name=".mainactivity"     android:label="@string/app_name" >     <intent-filter>         <action android:name="android.intent.action.main_activity" />          <category android:name="android.intent.category.default" />     </intent-filter> </activity> 

i'm still pretty new and/or advice of great value.

write :

intent = new intent(mainactivity.this, newactivity.class); startactivity(i); 

also need declare both activity class in manifest file this:

<activity android:name=".mainactivity" android:label="@string/app_name" > <intent-filter>     <action android:name="android.intent.action.main_activity" />      <category android:name="android.intent.category.default" /> </intent-filter> </activity> <activity     android:name=".newactivity"     android:label="@string/app_name" > </activity> 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -