Julien,

You do need <activity> entries in the manifest for all your activities, including MenuMain.

The intent filter for MenuMain is not necessary.

Other than that, check the logcat for error messages. Might be something wrong in menu_main.xml.

-- Kostya

04.01.2011 15:17, Rockline пишет:
Hello,

I've got a problem when I'm trying to create a new activity when I
click on a button.
My virtual device (emulator) crashes when I click on the button saying
something
like: "The application has stopped unexpectedly"

Could you please help?

My main activity I launch my application is LaunchRecruitMobile as
below. I'd like this activity to lauch another activity MenuMain when
I click on a button.



public class LaunchRecruitMobile extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.logon);


        ImageButton
btn=(ImageButton)findViewById(R.id.logon_ok_imagebutton);
        btn.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                 Intent intent = new Intent(LaunchRecruitMobile.this,
MenuMain.class);
                 startActivity(intent);
            }
        });

    } //end of constructor

  }


  public class MenuMain extends Activity {

     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.menu_main);
     }

  }




In the manifest I've only got:
<application android:icon="@drawable/icon" android:label="@string/
app_name">
        <activity android:name=".LaunchRecruitMobile"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
</application>

I've tried the same in adding the following but doesn't work neither:
<activity android:name=".MenuMain"
                   android:label="@string/app_name">
             <intent-filter>
                 <action android:name="android.intent.action.DEFAULT" /
             </intent-filter>
         </activity>


Thanks a lot.
Best regards.
Julien.



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to