Reputation: 4280
I am following [this tutorial][1], it has 2 parts. I followed part 1 and ran the app, it worked perfectly. Then I followed part 2 and I keep getting this RuntimeException
09-03 18:32:29.339: E/AndroidRuntime(21044): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tvgenius/com.tvgenius.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
09-03 18:32:29.339: E/AndroidRuntime(21044): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
09-03 18:32:29.339: E/AndroidRuntime(21044): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
I followed the tutorial exactly. I don't know what I'm missing...
Solution: minSdkVersion
for Fragments required is 12, mine was 11.
Upvotes: 0
Views: 130
Reputation: 2305
to use fragments you need minimum sdk version to be 12 or you have to download a support library.
Just right click on your project->android tools -> add support library...
Instead of:
import android.app.Fragment;
you have to use:
import android.support.v4.app.Fragment;
Upvotes: 1