Reputation: 57
Since I am not an expert, I could not identify the error below is the logcat. I am calling the another page onclick
button. While loading another page I am getting an error at
setContentView(R.layout.searchm);
below is source code and locgcat
Logcat is as below
09-09 05:49:46.896: E/AndroidRuntime(2657): FATAL EXCEPTION: main
09-09 05:49:46.896: E/AndroidRuntime(2657): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.androidhive.googlemaps/com.androidhive.googlemaps.SearchActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class CustomAutoCompleteTextView
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.os.Handler.dispatchMessage(Handler.java:99)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.os.Looper.loop(Looper.java:137)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.ActivityThread.main(ActivityThread.java:5103)
09-09 05:49:46.896: E/AndroidRuntime(2657): at java.lang.reflect.Method.invokeNative(Native Method)
09-09 05:49:46.896: E/AndroidRuntime(2657): at java.lang.reflect.Method.invoke(Method.java:525)
09-09 05:49:46.896: E/AndroidRuntime(2657): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-09 05:49:46.896: E/AndroidRuntime(2657): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-09 05:49:46.896: E/AndroidRuntime(2657): at dalvik.system.NativeStart.main(Native Method)
09-09 05:49:46.896: E/AndroidRuntime(2657): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class CustomAutoCompleteTextView
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
09-09 05:49:46.896: E/AndroidRuntime(2657): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.Activity.setContentView(Activity.java:1895)
09-09 05:49:46.896: E/AndroidRuntime(2657): at com.androidhive.googlemaps.SearchActivity.onCreate(SearchActivity.java:26)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.Activity.performCreate(Activity.java:5133)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
09-09 05:49:46.896: E/AndroidRuntime(2657): ... 11 more
09-09 05:49:46.896: E/AndroidRuntime(2657): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.CustomAutoCompleteTextView" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.androidhive.googlemaps-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.androidhive.googlemaps-2, /vendor/lib, /system/lib]]
09-09 05:49:46.896: E/AndroidRuntime(2657): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
09-09 05:49:46.896: E/AndroidRuntime(2657): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-09 05:49:46.896: E/AndroidRuntime(2657): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.createView(LayoutInflater.java:559)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:652)
09-09 05:49:46.896: E/AndroidRuntime(2657): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
09-09 05:49:46.896: E/AndroidRuntime(2657): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
09-09 05:49:46.896: E/AndroidRuntime(2657): ... 21 more
Upvotes: 3
Views: 587
Reputation: 28484
In your xml file
<CustomAutoCompleteTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
replace with
<YoupPckageNameSpecifiedInYourCustomview.CustomAutoCompleteTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
Upvotes: 2
Reputation: 57306
I think you are using class CustomAutoCompleteTextView
(probably extending from AutoCompleteTextView
) in a layout XML, without using the full class name (with package). When this is the case, Android will automatically try to find this class in package android.view
- but in your case it fails to do so (because the calss doesn't exist there). Most likely, your XML has something like this:
<CustomAutoCompleteTextView ...>
Instead, with custom classes you need to specify full class name with package - so change it to
<com.your.package.CustomAutoCompleteTextView ...>
Upvotes: 2
Reputation: 3177
If you are running the project on emulator running with Android Api, Then Run/Test your Project using Emulator with Google-API.
Upvotes: 0
Reputation: 126
I think you are trying to reference a class CustomAutoCompleteTextView when it should be AutoCompleteTextView
"Didn't find class "android.view.CustomAutoCompleteTextView""
you need to either define this class in your own app or user the android one
Upvotes: 0