This question already has an answer here:
i am trying to start a new activity with another somelayout.xml page in my project and it's keep crushing and giving me a null pointer exception, here is my code: what am I doing wrong?
MainActivity.java:
public void testF(View view) { Intent intent = new Intent(this, SummaryPage.class); //tried also with getApplicationContext() instead of this startActivity(intent); }
AndroidMainfest.xml:
</intent-filter> </activity> <activity android:name=".SummaryPage" /> </application>
SumarryPage.java:
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.summary_page); }
summary_page.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:background="@color/Black" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:textColor="#FFFF" android:textSize="48dp" android:text="summarypage" /> </LinearLayout>
Thanks a lot, Or Yaacov
No comments:
Post a Comment