package com.android.history; import android.os.Bundle; import android.content.Intent; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; public class MainActivity extends Fragment{ //new EULA(this).show(); @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.main, container, false); ImageView imgView = (ImageView) view.findViewById(R.id.Drivers); //TextView random = (TextView) view.findViewById(R.id.testbutton); imgView.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent gotosomething = new Intent(getActivity(), DriversMain.class); startActivity(gotosomething); } }); /*LOGCAT 11-12 22:40:49.145: D/AndroidRuntime(11567): Shutting down VM 11-12 22:40:49.145: W/dalvikvm(11567): threadid=1: thread exiting with uncaught exception (group=0x40a451f8) 11-12 22:40:49.155: E/AndroidRuntime(11567): FATAL EXCEPTION: main 11-12 22:40:49.155: E/AndroidRuntime(11567): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.android.history/com.android.history.DriversMain}: java.lang.ClassCastException: com.android.history.DriversMain cannot be cast to android.app.Activity 11-12 22:40:49.155: E/AndroidRuntime(11567): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1993) 11-12 22:40:49.155: E/AndroidRuntime(11567): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104) 11-12 22:40:49.155: E/AndroidRuntime(11567): at android.app.ActivityThread.access$600(ActivityThread.java:132) 11-12 22:40:49.155: E/AndroidRuntime(11567): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1157) 11-12 22:40:49.155: E/AndroidRuntime(11567): at android.os.Handler.dispatchMessage(Handler.java:99) 11-12 22:40:49.155: E/AndroidRuntime(11567): at android.os.Looper.loop(Looper.java:137) 11-12 22:40:49.155: E/AndroidRuntime(11567): at android.app.ActivityThread.main(ActivityThread.java:4575) 11-12 22:40:49.155: E/AndroidRuntime(11567): at java.lang.reflect.Method.invokeNative(Native Method) 11-12 22:40:49.155: E/AndroidRuntime(11567): at java.lang.reflect.Method.invoke(Method.java:511) 11-12 22:40:49.155: E/AndroidRuntime(11567): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 11-12 22:40:49.155: E/AndroidRuntime(11567): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 11-12 22:40:49.155: E/AndroidRuntime(11567): at dalvik.system.NativeStart.main(Native Method) 11-12 22:40:49.155: E/AndroidRuntime(11567): Caused by: java.lang.ClassCastException: com.android.history.DriversMain cannot be cast to android.app.Activity 11-12 22:40:49.155: E/AndroidRuntime(11567): at android.app.Instrumentation.newActivity(Instrumentation.java:1023) 11-12 22:40:49.155: E/AndroidRuntime(11567): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1984) 11-12 22:40:49.155: E/AndroidRuntime(11567): ... 11 more 11-12 22:40:51.144: I/Process(11567): Sending signal. PID: 11567 SIG: 9