大家好,我有安卓的屏幕问题我在youtube上关注newboston频道的Android教程我做同样的步骤他做了我有错误我不能在下一个屏幕切换我有这个代码请有人可以帮助我......:/
package com.ribarce.stefan;
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 Menu extends ListActivity {
String classes[] = { "MainActivity", "exsample1", "exsample2", "exsample3",
"exsample4", "exsample5", "exsample6" };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(Menu.this,
android.R.layout.simple_list_item_1, classes));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
String cheese = classes[position];
try {
Class myClass = Class.forName("com.riba.stefan." + cheese);
Intent myIntent = new Intent(Menu.this, myClass);
startActivity(myIntent);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}