应用程序没有崩溃,但我只是得到一个空白页....如果您需要更多,请告诉我,如果我做错了,对不起似乎我必须添加更多信息,我真的不知道要添加什么可能是我有错误的导入还是什么?:
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>