應用程序不會崩潰,但我只是得到一個空白頁面......繼承人代碼告訴我,如果你需要更多,對不起,如果我做這個錯誤似乎我必須添加更多的信息,我真的不知道添加什麼可能是我有錯的進口或財產以後?:我不能讓ListActivity顯示
package com.eric.thebasics;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class TutorialTwo extends ListActivity {
String classNames[] = {"main", "menu", "Sweet", "TutorialOne"};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1));
}
protected void onListItemClick(ListView lv, View v, int position, long id){
super.onListItemClick(lv, v, position, id);
String openClass = classNames[position];
try{
Class selected = Class.forName("com.eric.thebasics." + openClass);
Intent selectedIntent = new Intent(this,selected);
startActivity(selectedIntent);
}catch (ClassNotFoundException e){
e.printStackTrace();
}
}
}
這裏的按鈕代碼:
tut2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
buttonSound.start();
startActivity(new Intent("com.eric.thebasics.TUTORIALTWO"));
這裏是明顯的:
<activity
android:name=".TutorialTwo"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.eric.thebasics.TUTORIALTWO" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
哇,好難過大聲笑..... tyvm – 2013-03-04 02:46:28
哈哈容易犯錯! – ElefantPhace 2013-03-04 02:48:15