I am trying to open another view from the options menu of my program.

My options_menu.xml:
<menu xmlns:android="http://schemas.android.com/apk/res/android";>
    <item android:id="@+id/settings_button"
          android:title="Settings"
          android:icon="@android:drawable/ic_menu_preferences" />
    <item android:id="@+id/about_button"
          android:title="About"
          android:icon="@android:drawable/ic_menu_myplaces" />
</menu>

My mnfsms.java
package com.example.mnfsms;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

public class mnfsms extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        /*        OnClickListener myocl = new View.OnClickListener() {
        public void onClick(View v){
                Intent myi = new Intent(mnfsms.this, mnfsms_settings.class);
                startActivity(myi);
        }
    };*/
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.options_menu, menu);

        MenuItem mi_settings = (MenuItem)findViewById
(R.id.settings_button);
        mi_settings.setIntent(new Intent(this,
mnfsms_settings.class));

        return true;
    }
}

mnfsms_settings (another activity) is what I am trying to open.

Whether the Intent is in the onCreateOptionsMenu or onCreate
functions, the application still crashes when it sets the intent to
the item.

What I have used to try to help me:
http://developer.android.com/guide/topics/intents/intents-filters.html
http://developer.android.com/resources/faq/commontasks.html#opennewscreen
http://developer.android.com/guide/topics/ui/menus.html
http://developer.android.com/guide/topics/fundamentals.html
http://learnandroid.blogspot.com/2008/01/opening-new-screen-in-android.html
-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to