0
Reply

Button Start New Activity cannot start?

Ask a question
nunue turn

nunue turn

11y
1.1k
1



i have created apps in eclipse with target sdk in API 15 and. I want to make button start new activity. i have created that code but i have a problem. when i run in on my phone ninetology stealh 2, when i click a button and my app has crash and my phone show me this :

"Unfortunately start"

i have tested it in others phone two and it show same problem. i also use more technique that i learn from thenewboston, vongella an other but still have same problem. here is my .xml and java code :-

  1. menu.java
package com.mytuturkiu.mytuturkiu;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;                                                                                                                                                                                                                       
import android.widget.Button;
import android.content.Intent;

    public class Menu extends Activity {

      Button btnmodul;

      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_menu);

          btnmodul = (Button)findViewById(R.id.btnmodul);      
            btnmodul.setOnClickListener(new View.OnClickListener() {

              @Override
              public void onClick(View v) {
          // TODO Auto-generated method stub
              Intent vokal = new Intent(v.getContext(),Modul_Vokal.class);
              startActivity(vokal);
          }
      } );

  }



}
  1. Modul_vokal.java

package com.mytuturkiu.mytuturkiu;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class Modul_Vokal extends Activity {

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

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.modul__vokal, menu);
      return true;
  }

}
  1. AndroidManifest.xml

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="15" />
    
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.mytuturkiu.mytuturkiu.Menu"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
    
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.mytuturkiu.mytuturkiu.Modul_Vokal"
            android:label="@string/title_activity_modul__vokal" >
        </activity>
    
    </application>

what problem with my apps?..