- Blank screen displayed on option menu click
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- Intent intent = new Intent();
- switch (item.getItemId()) {
- case R.id.some_menu:
- intent.setComponent(new ComponentName(MyActivity.this,SomeActivity.class));
- startActivity(intent);
- return true;
- case R.id.someother_menu:
- intent.setComponent(new ComponentName(MyActivity.this, SomeOtherActivity.class));
- startActivity(intent);
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
- <TextView
- android:id="@+id/follow"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="25sp"
- />
- <ListView
- android:id="@+id/follow_list"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- </ListView>
- </LinearLayout>
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent" android:layout_height="match_parent"
- android:orientation="vertical" >
- <TextView
- android:id="@+id/follow"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="25sp"
- android:text="DUMMYTEXT"
- />
- <ListView
- android:id="@+id/follow_list"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- </ListView>
- </LinearLayout>
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- Intent intent = new Intent();
- switch (item.getItemId()) {
- case R.id.some_menu:
- intent.setComponent(new ComponentName(MyActivity.this,SomeActivity.class));
- startActivity(intent);
- return true;
- case R.id.someother_menu:
- intent.setComponent(new ComponentName(MyActivity.this, SomeOtherActivity.class));
- startActivity(intent);
- return true;
- }
- return super.onOptionsItemSelected(item);
- }