My code works until I add line 7 in, at which point it crashes.
private void registerClickCallback() {
ListView list = (ListView) findViewById(R.id.listview);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (position == 0) {
startActivity(new Intent(getApplicationContext(), ResourcesArea.class));
}
}
});
}
Could someone give me an idea of where to look to find out what's going wrong? I have only just started with the ADT
and I am not sure how to find out what's making it crash.
This is the logcat error messages:
07-30 13:52:00.483: E/AndroidRuntime(1099): FATAL EXCEPTION: main
07-30 13:52:00.483: E/AndroidRuntime(1099): java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
07-30 13:52:00.483: E/AndroidRuntime(1099): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:107)
07-30 13:52:00.483: E/AndroidRuntime(1099): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
07-30 13:52:00.483: E/AndroidRuntime(1099): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
07-30 13:52:00.483: E/AndroidRuntime(1099): at org.thetutortrust.tutortrust.ResourcesArea.onCreate(ResourcesArea.java:16)
07-30 13:52:00.483: E/AndroidRuntime(1099): at android.app.Activity.performCreate(Activity.java:4538)
07-30 13:52:00.483: E/AndroidRuntime(1099): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1071)
07-30 13:52:00.483: E/AndroidRuntime(1099): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
07-30 13:52:00.483: E/AndroidRuntime(1099): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2240)
07-30 13:52:00.483: E/AndroidRuntime(1099): at android.app.ActivityThread.access$600(ActivityThread.java:139)
07-30 13:52:00.483: E/AndroidRuntime(1099): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
07-30 13:52:00.483: E/AndroidRuntime(1099): at android.os.Handler.dispatchMessage(Handler.java:99)
07-30 13:52:00.483: E/AndroidRuntime(1099): at android.os.Looper.loop(Looper.java:156)
07-30 13:52:00.483: E/AndroidRuntime(1099): at android.app.ActivityThread.main(ActivityThread.java:4987)
07-30 13:52:00.483: E/AndroidRuntime(1099): at java.lang.reflect.Method.invokeNative(Native Method)
07-30 13:52:00.483: E/AndroidRuntime(1099): at java.lang.reflect.Method.invoke(Method.java:511)
07-30 13:52:00.483: E/AndroidRuntime(1099): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-30 13:52:00.483: E/AndroidRuntime(1099): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-30 13:52:00.483: E/AndroidRuntime(1099): at dalvik.system.NativeStart.main(Native Method)