这是发生错误的主要活动
public class MainActivity extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// storing string resources into Array
String[] adobe_products = getResources().getStringArray(R.array.Events);
// Binding resources Array to ListAdapter
this.setListAdapter(new ArrayAdapter<>(this, R.layout.list_data, R.id.label, adobe_products));
ListView lv = getListView();
// listening to single list item on click
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> a, View v, int position, long id) {
// In the following line "v" refers to the View returned by the `getView()` method; meaning the clicked View.
TextView txtName = (TextView) v.findViewById(R.id.product_label);
String name;
name = txtName.getText().toString();
switch (name) {
case "Sports":
Intent intent;
intent = new Intent(MainActivity.this, Sports.class);
startActivity(intent);
break;
case "Lunch":
Intent intent1;
intent1 = new Intent(MainActivity.this, Lunch.class);
startActivity(intent1);
break;
case "contacts":
Intent intent2;
intent2 = new Intent(MainActivity.this, Contacts.class);
startActivity(intent2);
break;
}
}
});
}
}
这是错误
reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com. android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 02-06 09:52:44.609 938-962/? E/gralloc_goldfish:gralloc_alloc:不匹配的使用标志:576 x 576,使用 333 02-06 09:52:44.609 938-962/?E/: GraphicBufferAlloc::createGraphicBuffer(w=576, h=576) failed (Invalid argument), handle=0x0 02-06 09:52:44.624 1249-1280/system_process E/BufferQueueProducer: [ScreenshotClient] dequeueBuffer: createGraphicBuffer failed 02 -06 09:52:44.629 1249-1280/system_process E/ActivityManager: 缩略图尺寸无效:576x576 02-06 10:12:01.500 2233-2233/? E/memtrack﹕无法' t 加载 memtrack 模块(没有这样的文件或目录) 02-06 10:12:01.500 2233-2233/? E/android.os.Debug:加载memtrack模块失败:-2 02-06 10:12:01.963 2243-2243/? E/libprocessgroup: 无法制作和 chown /acct/uid_10054: 只读文件系统 02-06 10:12:08.952 2243-2243/com.example.trobinson.fblaproject E/AndroidRuntime: 致命例外: 主进程: com. example.trobinson.fblaproject,PID:2243
我们不确定该怎么做。