別のインテントを呼び出したときのエラー
私はこの問題を解決することができず、コース修了の仕事を終えるためにできるだけ早く解決する必要がありました。助けてくれてありがとう!
06-09 14:41:28.902: E/AndroidRuntime(769): FATAL EXCEPTION: main
06-09 14:41:28.902: E/AndroidRuntime(769): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{br.com.projeto_tcc/br.com.projeto_tcc.view.EscolhaGUI}: java.lang.NullPointerException
06-09 14:41:28.902: E/AndroidRuntime(769):
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
06-09 14:41:28.902: E/AndroidRuntime(769):
私のマニフェスト
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="br.com.projeto_tcc"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="br.com.projeto_tcc.view.NewPlayerGUI"
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="br.com.projeto_tcc.view.PlayerGUI"/>
<activity android:name="br.com.projeto_tcc.view.OpcaoGUI"/>
<activity android:name="br.com.projeto_tcc.view.JogoGUI"/>
<activity android:name="br.com.projeto_tcc.view.EscolhaGUI"/>
<activity android:name="br.com.projeto_tcc.bluetooth.Actv"/>
<activity android:name="br.com.projeto_tcc.bluetooth.MainActivity"/>
</application>
</manifest>
私のクラス
public class EscolhaGUI extends Activity {
Intent intent = new Intent(this, Actv.class);
Intent intent2 = new Intent(this, MainActivity.class);
@Override
protected void onCreate(Bundle savedInstanceState) {
try {
final Button btn_esp = (Button) findViewById(R.id.btn_esp);
final Button btn_conv = (Button) findViewById(R.id.btn_conv);
super.onCreate(savedInstanceState);
setContentView(R.layout.escolher);
btn_esp.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
finish();
startActivity(intent);
}
});
btn_conv.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
finish();
startActivity(intent2);
}
});
} catch (Exception e) {
AlertDialog alertDialog;
alertDialog = new AlertDialog.Builder(this).create();
alertDialog.setTitle("Erro");
alertDialog.setMessage("Este: ." + e);
alertDialog.show();
}
}