Getting run time exception as "inflating class fragment" when I tried to add Google map in my android application. I go through all the previous comments similar to which I have posted. But I couldn't solve it.
Log file is attached here
08-07 05:30:41.587: E/AndroidRuntime(2574): FATAL EXCEPTION: main
08-07 05:30:41.587: E/AndroidRuntime(2574): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.newapp/com.example.newapp.NewApp}: android.view.InflateException: Binary XML file line #17: Error inflating class fragment
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.app.ActivityThread.access$600(ActivityThread.java:141)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.os.Handler.dispatchMessage(Handler.java:99)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.os.Looper.loop(Looper.java:137)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.app.ActivityThread.main(ActivityThread.java:5103)
08-07 05:30:41.587: E/AndroidRuntime(2574): at java.lang.reflect.Method.invokeNative(Native Method)
08-07 05:30:41.587: E/AndroidRuntime(2574): at java.lang.reflect.Method.invoke(Method.java:525)
08-07 05:30:41.587: E/AndroidRuntime(2574): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
08-07 05:30:41.587: E/AndroidRuntime(2574): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-07 05:30:41.587: E/AndroidRuntime(2574): at dalvik.system.NativeStart.main(Native Method)
08-07 05:30:41.587: E/AndroidRuntime(2574): Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class fragment
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
08-07 05:30:41.587: E/AndroidRuntime(2574): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.app.Activity.setContentView(Activity.java:1895)
08-07 05:30:41.587: E/AndroidRuntime(2574): at com.example.newapp.NewApp.onCreate(NewApp.java:12)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.app.Activity.performCreate(Activity.java:5133)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
08-07 05:30:41.587: E/AndroidRuntime(2574): ... 11 more
08-07 05:30:41.587: E/AndroidRuntime(2574): Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.support.v4.app.Fragment.instantiate(Fragment.java:409)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.support.v4.app.Fragment.instantiate(Fragment.java:377)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:277)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
08-07 05:30:41.587: E/AndroidRuntime(2574): ... 21 more
08-07 05:30:41.587: E/AndroidRuntime(2574): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.SupportMapFragment" on path: DexPathList[[zip file "/data/app/com.example.newapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.newapp-1, /vendor/lib, /system/lib]]
08-07 05:30:41.587: E/AndroidRuntime(2574): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
08-07 05:30:41.587: E/AndroidRuntime(2574): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
08-07 05:30:41.587: E/AndroidRuntime(2574): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
08-07 05:30:41.587: E/AndroidRuntime(2574): at android.support.v4.app.Fragment.instantiate(Fragment.java:399)
08-07 05:30:41.587: E/AndroidRuntime(2574): ... 24 more
08-07 05:30:47.677: I/Process(2574): Sending signal. PID: 2574 SIG: 9
08-07 05:30:53.767: D/AndroidRuntime(2650): Shutting down VM
08-07 05:30:53.767: W/dalvikvm(2650): threadid=1: thread exiting with uncaught exception (group=0x414c4700)
08-07 05:30:53.857: E/AndroidRuntime(2650): FATAL EXCEPTION: main
08-07 05:30:53.857: E/AndroidRuntime(2650): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.newapp/com.example.newapp.NewApp}: android.view.InflateException: Binary XML file line #17: Error inflating class fragment
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.app.ActivityThread.access$600(ActivityThread.java:141)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.os.Handler.dispatchMessage(Handler.java:99)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.os.Looper.loop(Looper.java:137)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.app.ActivityThread.main(ActivityThread.java:5103)
08-07 05:30:53.857: E/AndroidRuntime(2650): at java.lang.reflect.Method.invokeNative(Native Method)
08-07 05:30:53.857: E/AndroidRuntime(2650): at java.lang.reflect.Method.invoke(Method.java:525)
08-07 05:30:53.857: E/AndroidRuntime(2650): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
08-07 05:30:53.857: E/AndroidRuntime(2650): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-07 05:30:53.857: E/AndroidRuntime(2650): at dalvik.system.NativeStart.main(Native Method)
08-07 05:30:53.857: E/AndroidRuntime(2650): Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class fragment
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
08-07 05:30:53.857: E/AndroidRuntime(2650): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.app.Activity.setContentView(Activity.java:1895)
08-07 05:30:53.857: E/AndroidRuntime(2650): at com.example.newapp.NewApp.onCreate(NewApp.java:12)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.app.Activity.performCreate(Activity.java:5133)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
08-07 05:30:53.857: E/AndroidRuntime(2650): ... 11 more
08-07 05:30:53.857: E/AndroidRuntime(2650): Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.support.v4.app.Fragment.instantiate(Fragment.java:409)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.support.v4.app.Fragment.instantiate(Fragment.java:377)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:277)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
08-07 05:30:53.857: E/AndroidRuntime(2650): ... 21 more
08-07 05:30:53.857: E/AndroidRuntime(2650): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.SupportMapFragment" on path: DexPathList[[zip file "/data/app/com.example.newapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.newapp-1, /vendor/lib, /system/lib]]
08-07 05:30:53.857: E/AndroidRuntime(2650): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
08-07 05:30:53.857: E/AndroidRuntime(2650): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
08-07 05:30:53.857: E/AndroidRuntime(2650): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
08-07 05:30:53.857: E/AndroidRuntime(2650): at android.support.v4.app.Fragment.instantiate(Fragment.java:399)
08-07 05:30:53.857: E/AndroidRuntime(2650): ... 24 more
08-07 05:30:56.837: I/Process(2650): Sending signal. PID: 2650 SIG: 9
manifest.xml file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.newapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="********************************" />
<permission
android:name="com.venky.maps.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.newapp.maps.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.newapp.NewApp"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
and the java file NewApp.java
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
public class NewApp extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_app);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.new_app, menu);
return true;
}
}
activity_new_app.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".NewApp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hello_world" />
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Please help me to solve this problem.
One visible mistake
https://developers.google.com/maps/documentation/android/start
Your meta tag must be a child of application tag in manifest
<meta-data // should be inside application tag.
android:name="com.google.android.maps.v2.API_KEY"
android:value="********************************" />
Change this
<permission
android:name="com.venky.maps.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
to
<permission
android:name="com.example.newapp.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
Related
I am working on a project which requires on the fly language changes. I am attempting to set the desired Locale but as soon as I do, the app crashes complaining that it cannot find Resources (things like R.layout.* R.drawable.*)
This is the code I am using to set the new Locale:
String languageToLoad = "es";
Locale locale = new Locale(languageToLoad);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics());
Edit: added log
E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.flavorburst.mcdonalds/com.flavorburst.mcdonalds.MyActivity}: android.view.InflateException: Binary XML file line #25: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
at android.app.Activity.setContentView(Activity.java:1881)
at com.flavorburst.mcdonalds.MyActivity.onCreate(MyActivity.java:106)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: String array resource ID #0x7f08001e
at android.content.res.Resources.getStringArray(Resources.java:451)
at com.flavorburst.mcdonalds.NavigationDrawerFragment.onCreate(NavigationDrawerFragment.java:91)
at android.app.Fragment.performCreate(Fragment.java:1673)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:854)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035)
at android.app.FragmentManagerImpl.addFragment(FragmentManager.java:1137)
at android.app.Activity.onCreateView(Activity.java:4717)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
at android.app.Activity.setContentView(Activity.java:1881)
at com.flavorburst.application.MyActivity.onCreate(MyActivity.java:106)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
This error:
Caused by: android.content.res.Resources$NotFoundException: String array resource ID #0x7f08001e at android.content.res.Resources.getStringArray(Resources.java:451) at com.flavorburst.mcdonalds.NavigationDrawerFragment
refers to a string array that you have defined in one of your XML files, but you forgot to create the string array value in /values/array.xml. For example, in one of your XML files, you may have specified a string array value of "arrayNames", but you forgot to declare it in /values/array.xml like:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="arrayNames"/>
</resources>
So, at runtime, the compiler will complain that it cannot find "arrayNames" in /values/array.xml. Hence, the error you got when you run your app.
Have you tried to clean and rebuild your project? If you are using eclipse got to Project -> Clean. And then build again. If you are using Android Studio and gradle, type the following command line on a terminal:
./gradlew clean
or
use the Build -> Rebuild Project
I have an autocompletetextview. I want a method to run "onClick". Here is my XML:
<AutoCompleteTextView
android:id="#+id/GivenByBox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="setupMiranda"
android:gravity="left"
/>
When this is run, I get errors. It doesn't matter what onClick is set to, it will always cause an error. If I remove the android:onclick line everything works fine, but that is not what I want.
Here is an excerpt from logCat:
08-07 13:56:36.040: E/AndroidRuntime(32735): FATAL EXCEPTION: main
08-07 13:56:36.040: E/AndroidRuntime(32735): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.itsmr.dre_android_clean/com.itsmr.dre_android_clean.MainActivity}: android.view.InflateException: Binary XML file line #46: Error inflating class <unknown>
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.app.ActivityThread.access$700(ActivityThread.java:140)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.os.Handler.dispatchMessage(Handler.java:99)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.os.Looper.loop(Looper.java:137)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.app.ActivityThread.main(ActivityThread.java:4921)
08-07 13:56:36.040: E/AndroidRuntime(32735): at java.lang.reflect.Method.invokeNative(Native Method)
08-07 13:56:36.040: E/AndroidRuntime(32735): at java.lang.reflect.Method.invoke(Method.java:511)
08-07 13:56:36.040: E/AndroidRuntime(32735): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
08-07 13:56:36.040: E/AndroidRuntime(32735): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
08-07 13:56:36.040: E/AndroidRuntime(32735): at dalvik.system.NativeStart.main(Native Method)
08-07 13:56:36.040: E/AndroidRuntime(32735): Caused by: android.view.InflateException: Binary XML file line #46: Error inflating class <unknown>
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
08-07 13:56:36.040: E/AndroidRuntime(32735): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
08-07 13:56:36.040: E/AndroidRuntime(32735): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:316)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.app.Activity.setContentView(Activity.java:1924)
08-07 13:56:36.040: E/AndroidRuntime(32735): at com.itsmr.dre_android_clean.MainActivity.onCreate(MainActivity.java:81)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.app.Activity.performCreate(Activity.java:5188)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
08-07 13:56:36.040: E/AndroidRuntime(32735): ... 11 more
08-07 13:56:36.040: E/AndroidRuntime(32735): Caused by: java.lang.reflect.InvocationTargetException
08-07 13:56:36.040: E/AndroidRuntime(32735): at java.lang.reflect.Constructor.constructNative(Native Method)
08-07 13:56:36.040: E/AndroidRuntime(32735): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
08-07 13:56:36.040: E/AndroidRuntime(32735): ... 26 more
08-07 13:56:36.040: E/AndroidRuntime(32735): Caused by: java.lang.NullPointerException
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.widget.AutoCompleteTextView$PassThroughClickListener.access$302(AutoCompleteTextView.java:1226)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.widget.AutoCompleteTextView.setOnClickListener(AutoCompleteTextView.java:200)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.view.View.<init>(View.java:3678)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.widget.TextView.<init>(TextView.java:574)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.widget.EditText.<init>(EditText.java:76)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.widget.AutoCompleteTextView.<init>(AutoCompleteTextView.java:137)
08-07 13:56:36.040: E/AndroidRuntime(32735): at android.widget.AutoCompleteTextView.<init>(AutoCompleteTextView.java:133)
08-07 13:56:36.040: E/AndroidRuntime(32735): ... 29 more
I get this error no matter what function is set onClick. Even a function with an empty body causes this error.
What is causing this error?
I'm trying to open a web browser from my app using:
Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse("http://developer.android.com/"));
startActivity(browser);
But the app just crashes:
08-07 17:18:29.912: E/AndroidRuntime(751): FATAL EXCEPTION: main
08-07 17:18:29.912: E/AndroidRuntime(751): java.lang.NullPointerException
08-07 17:18:29.912: E/AndroidRuntime(751): at android.app.Activity.startActivityForResult(Activity.java:3131)
08-07 17:18:29.912: E/AndroidRuntime(751): at android.app.Activity.startActivity(Activity.java:3237)
08-07 17:18:29.912: E/AndroidRuntime(751): at com.Co.DrumKit$9.onClick(DrumKit.java:658)
08-07 17:18:29.912: E/AndroidRuntime(751): at android.view.View.performClick(View.java:3110)
08-07 17:18:29.912: E/AndroidRuntime(751): at android.view.View$PerformClick.run(View.java:11934)
08-07 17:18:29.912: E/AndroidRuntime(751): at android.os.Handler.handleCallback(Handler.java:587)
08-07 17:18:29.912: E/AndroidRuntime(751): at android.os.Handler.dispatchMessage(Handler.java:92)
08-07 17:18:29.912: E/AndroidRuntime(751): at android.os.Looper.loop(Looper.java:132)
08-07 17:18:29.912: E/AndroidRuntime(751): at android.app.ActivityThread.main(ActivityThread.java:4123)
08-07 17:18:29.912: E/AndroidRuntime(751): at java.lang.reflect.Method.invokeNative(Native Method)
08-07 17:18:29.912: E/AndroidRuntime(751): at java.lang.reflect.Method.invoke(Method.java:491)
08-07 17:18:29.912: E/AndroidRuntime(751): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
08-07 17:18:29.912: E/AndroidRuntime(751): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
08-07 17:18:29.912: E/AndroidRuntime(751): at dalvik.system.NativeStart.main(Native Method)
Hello i will be needing help with my Android app to insert google maps into the app, but every time i do that the app chrashes, and i'm going to insert my code below if there is somebody that can help my to find the problem with the code.
Androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.maret.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="17" />
<permission
android:name="com.maret.toilet.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-permission android:name="com.maret.toilet.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.maret.toilet.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="***MY_API_KEY****"/>
</application>
</manifest>
Here is my activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="My Location"
android:onClick="getLocation"
android:layout_weight="0"
/>
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment"/>
</LinearLayout>
Here is my MainActivity.java
package com.maret.maps;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
MY ERROR LOG
03-19 08:41:45.552: E/Trace(641): error opening trace file:
No such file or directory (2)
03-19 08:41:45.861: D/AndroidRuntime(641):
Shutting down VM
03-19 08:41:45.872: W/dalvikvm(641):
threadid=1: thread exiting with uncaught exception (group=0x40a13300)
03-19 08:41:45.891: E/AndroidRuntime(641): FATAL EXCEPTION: main
03-19 08:41:45.891: E/AndroidRuntime(641):
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.maret.toilet/com.maret.toilet.MainActivity}: android.view.InflateException:
Binary XML file line #15: Error inflating class fragment
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.access$600(ActivityThread.java:130)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.os.Handler.dispatchMessage(Handler.java:99)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.os.Looper.loop(Looper.java:137)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.main(ActivityThread.java:4745)
03-19 08:41:45.891: E/AndroidRuntime(641):
at java.lang.reflect.Method.invokeNative(Native Method)
03-19 08:41:45.891: E/AndroidRuntime(641):
at java.lang.reflect.Method.invoke(Method.java:511)
03-19 08:41:45.891: E/AndroidRuntime(641):
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-19 08:41:45.891: E/AndroidRuntime(641):
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-19 08:41:45.891: E/AndroidRuntime(641):
at dalvik.system.NativeStart.main(Native Method)
03-19 08:41:45.891: E/AndroidRuntime(641):
Caused by: android.view.InflateException:
Binary XML file line #15: Error inflating class fragment
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-19 08:41:45.891: E/AndroidRuntime(641):
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Activity.setContentView(Activity.java:1867)
03-19 08:41:45.891: E/AndroidRuntime(641):
at com.maret.toilet.MainActivity.onCreate(MainActivity.java:12)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Activity.performCreate(Activity.java:5008)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
03-19 08:41:45.891: E/AndroidRuntime(641): ... 11 more
03-19 08:41:45.891: E/AndroidRuntime(641):
Caused by: android.app.Fragment$InstantiationException:
Unable to instantiate fragment com.google.android.gms.maps.MapFragment:
make sure class name exists, is public, and has an empty constructor that is public
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Fragment.instantiate(Fragment.java:584)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Fragment.instantiate(Fragment.java:552)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Activity.onCreateView(Activity.java:4656)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
03-19 08:41:45.891: E/AndroidRuntime(641): ... 21 more
03-19 08:41:45.891: E/AndroidRuntime(641):
Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment
03-19 08:41:45.891: E/AndroidRuntime(641):
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
03-19 08:41:45.891: E/AndroidRuntime(641):
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-19 08:41:45.891: E/AndroidRuntime(641):
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Fragment.instantiate(Fragment.java:574)
03-19 08:41:45.891: E/AndroidRuntime(641): ... 24 more
HERE IS THE NEW LAYOUT AND ACTIVITY
THIS IS main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:name="com.google.android.gms.maps.SupportMapFragment"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
* HERE IS MY main.java **
package com.maret.maps;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class Main extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
HERE IS THE NEW LOGCAT WHEN THE APP CHRASHES**
03-21 12:23:03.633: E/Trace(958): error opening trace file: No such file or directory (2)
03-21 12:23:04.422: D/AndroidRuntime(958): Shutting down VM
03-21 12:23:04.432: W/dalvikvm(958): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
03-21 12:23:04.452: E/AndroidRuntime(958): FATAL EXCEPTION: main
03-21 12:23:04.452: E/AndroidRuntime(958): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.maret.maps/com.maret.maps.Main}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.access$600(ActivityThread.java:130)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.os.Handler.dispatchMessage(Handler.java:99)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.os.Looper.loop(Looper.java:137)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.main(ActivityThread.java:4745)
03-21 12:23:04.452: E/AndroidRuntime(958): at java.lang.reflect.Method.invokeNative(Native Method)
03-21 12:23:04.452: E/AndroidRuntime(958): at java.lang.reflect.Method.invoke(Method.java:511)
03-21 12:23:04.452: E/AndroidRuntime(958): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-21 12:23:04.452: E/AndroidRuntime(958): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-21 12:23:04.452: E/AndroidRuntime(958): at dalvik.system.NativeStart.main(Native Method)
03-21 12:23:04.452: E/AndroidRuntime(958): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-21 12:23:04.452: E/AndroidRuntime(958): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Activity.setContentView(Activity.java:1867)
03-21 12:23:04.452: E/AndroidRuntime(958): at com.maret.maps.Main.onCreate(Main.java:12)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Activity.performCreate(Activity.java:5008)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
03-21 12:23:04.452: E/AndroidRuntime(958): ... 11 more
03-21 12:23:04.452: E/AndroidRuntime(958): Caused by: java.lang.ClassCastException: com.google.android.gms.maps.SupportMapFragment cannot be cast to android.app.Fragment
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Fragment.instantiate(Fragment.java:577)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Fragment.instantiate(Fragment.java:552)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Activity.onCreateView(Activity.java:4656)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
03-21 12:23:04.452: E/AndroidRuntime(958): ... 21 more
03-21 12:23:07.973: I/Process(958): Sending signal. PID: 958 SIG: 9
Here is blog post I wrote on how to create a Map fragment in your application:
Google Maps API V2
From your code it look like your permission are not defined properly, you need to add this:
<permission android:name="com.maret.maps.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.maret.maps.permission.MAPS_RECEIVE"/>
And please add your logcat stack trace at crash moment so we could understand more clearly what the problem is.
UPDATE:
From the error you are receiving:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.maret.toilet/com.maret.toilet.MainActivity}: android.view.InflateException:
Binary XML file line #15: Error inflating class fragment
it's seems that you are not referencing the google-play-services library as needed, and this is the reason the fragment can't be inflated. the MapFragment class can't be find.
please check the guide that I posted at the beginning of the answer to see how to make the referencing correctly.
Your application tag in your manifest is missing this line
<uses-library android:name="com.google.android.maps" />
Add that and it should fix the crash
EDIT : This will only work for maps api version 1
I'm using ActionBarSherlock and customized style for it:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center"
android:textColor="#color/grey"
android:id="#+id/bar_title"
style="#style/Text.Medium">
</TextView>
</LinearLayout>
View mActionBarView = getLayoutInflater().inflate(R.layout.action_bar_custom, null);
getSupportActionBar().setCustomView(mActionBarView);
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_HOME);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
In my activity I am overriding setTitle method:
#Override
public void setTitle(CharSequence title) {
TextView txt = (TextView) findViewById(R.id.bar_title);
txt.setText(title);
}
But when in fragment I call getActivity().setTitle(), variable txt in overrided setTitle equals to null.
What's the problem?
Log:
09-06 18:18:21.807: ERROR/AndroidRuntime(953): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.alwx.reader/com.alwx.reader.activity.BookActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
at com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:119)
at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:251)
at com.alwx.reader.activity.BookActivity.onCreate(BookActivity.java:19)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
... 11 more
Caused by: java.lang.NullPointerException
at com.alwx.reader.activity.BookActivity.setTitle(BookActivity.java:28)
at com.alwx.reader.fragment.BookFragment.onCreateView(BookFragment.java:52)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:846)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1061)
at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1160)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
... 22 more
//this will work
TextView txt = (TextView)mActionBarView. findViewById(R.id.bar_title);
txt.setText(title);
//there is no default style as Text.Medium. you are created change it
style="#android:style/TextAppearance.Medium"