-1

I have a MenuItem in my Activity. when i click any one of the menu in my Menuitem, it triggers the related avtivity. But when i clicked aboutus menu, the pop-up shows the heading as MainActivity. How to change this heading MainActivity ?

aboutus.xml

<?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/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="checking...." />

public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    switch(item.getItemId()) {
        case R.id.aboutus:
            Intent i = new Intent("android.intent.action.ABOUTUS");
            startActivity(i);
            break;
            case R.id.preferences:
                Intent p = new Intent("android.intent.action.PREFERENCES");
                startActivity(p);
                break;

    }
    return false;
} 

enter image description here

enter image description here

Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
user1822729
  • 825
  • 1
  • 13
  • 27

1 Answers1

0

you can use android:label property in Android Manifest

android:label="This is the Hello World Application"

also you set it dynamically. Create a xml layout titlebar.xml with required layout.

@Override
public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       final boolean titleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
       setContentView(R.layout.main);

       if ( titleSupported ) {
           getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.titlebar);
       }
}
Meghal Shah
  • 405
  • 2
  • 11