Hei guys。我是Android編程的新手。我試圖製作一個控制RC汽車的應用程序(Arduino)。在這個應用程序是下一個活動:活動之間的Android應用程序交換停止
- 按鈕命令
- 傾斜指令
- 聲音命令
- 說明
- 關於
當我打開應用程序突然停止和我不知道爲什麼。有人可以通過查看代碼來幫助我,並告訴我我做錯了什麼。非常感謝。
Button buttonCommand;
Button tiltCommand;
Button vocalCommand;
Button instructions;
Button about;
Button arduino; // Links Button
Button android; // Links Button
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.content_main);
buttonCommand = (Button)findViewById(R.id.buttons);
tiltCommand = (Button)findViewById(R.id.tilt);
vocalCommand = (Button)findViewById(R.id.vocal);
instructions = (Button)findViewById(R.id.instructions);
about = (Button)findViewById(R.id.about);
arduino = (Button)findViewById(R.id.arduino);
android = (Button)findViewById(R.id.android);
}
public void onClickButton(View view){
Intent i = new Intent(getApplicationContext(),ButtonCommand.class); // ButtonCommand Activity
startActivity(i);
}
public void onClickTilt(View view){
Intent i = new Intent(getApplicationContext(),TiltCommand.class); // TiltCommand Activity
startActivity(i);
}
public void onClickVocal(View view){
Intent i = new Intent(getApplicationContext(),VocalCommand.class); // VocalCommand Activity
startActivity(i);
}
public void onClickInstructions(View view){
Intent i = new Intent(getApplicationContext(),Instructions.class); // Instructions Activity
startActivity(i);
}
public void onClickAbout(View view){
Intent i = new Intent(getApplicationContext(),About.class); // About Activity
startActivity(i);
}
public void onClickArduino(View view){
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setData(Uri.parse("http://forum.arduino.cc/"));
startActivity(intent);
}
public void onClickAndroid(View view){
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setData(Uri.parse("http://forum.xda-developers.com/"));
startActivity(intent);
}
布納喬治,是非常重要的添加LogCat中顯示的消息 – Jorgesys
嘿。我知道。我的電腦運行有點慢,我正在使用傳統的調試模式。編碼的應用程序,使apk和安裝在我的手機上。對不起,無法提供LogCat消息。 –
您也可以在手機上運行LogCat。 – tynn