savishy / TestApp

My attempt to build a simple app that uses a database
0 stars 0 forks source link

InflateException causing crash #8

Closed savishy closed 8 years ago

savishy commented 8 years ago
01-18 14:19:24.668 27345-27345/com.vish.testapp E/AndroidRuntime: FATAL EXCEPTION: main
                                                              Process: com.vish.testapp, PID: 27345
                                                              android.view.InflateException: Binary XML file line #7: Error inflating class TextView
                                                                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
                                                                  at com.vish.testapp.IngredientsCompletionView.getViewForObject(IngredientsCompletionView.java:48)
                                                                  at com.vish.testapp.IngredientsCompletionView.getViewForObject(IngredientsCompletionView.java:33)
                                                                  at com.tokenautocomplete.TokenCompleteTextView.buildSpanForObject(TokenCompleteTextView.java:755)
                                                                  at com.tokenautocomplete.TokenCompleteTextView.replaceText(TokenCompleteTextView.java:767)
                                                                  at android.widget.AutoCompleteTextView.performCompletion(AutoCompleteTextView.java:891)
                                                                  at android.widget.AutoCompleteTextView.access$500(AutoCompleteTextView.java:91)
                                                                  at android.widget.AutoCompleteTextView$DropDownItemClickListener.onItemClick(AutoCompleteTextView.java:1192)
                                                                  at android.widget.AdapterView.performItemClick(AdapterView.java:299)
                                                                  at android.widget.AbsListView.performItemClick(AbsListView.java:1115)
                                                                  at android.widget.AbsListView$PerformClick.run(AbsListView.java:2928)
                                                                  at android.widget.AbsListView$3.run(AbsListView.java:3691)
                                                                  at android.os.Handler.handleCallback(Handler.java:733)
                                                                  at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                  at android.os.Looper.loop(Looper.java:136)
                                                                  at android.app.ActivityThread.main(ActivityThread.java:5072)
                                                                  at java.lang.reflect.Method.invokeNative(Native Method)
                                                                  at java.lang.reflect.Method.invoke(Method.java:515)
                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
                                                                  at dalvik.system.NativeStart.main(Native Method)
                                                               Caused by: java.lang.ClassCastException: com.vish.testapp.IngredientsCompletionView cannot be cast to android.view.ViewParent
                                                                  at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:935)
                                                                  at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:992)
                                                                  at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
                                                                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:495) 
                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:400) 
                                                                  at com.vish.testapp.IngredientsCompletionView.getViewForObject(IngredientsCompletionView.java:48) 
                                                                  at com.vish.testapp.IngredientsCompletionView.getViewForObject(IngredientsCompletionView.java:33) 
                                                                  at com.tokenautocomplete.TokenCompleteTextView.buildSpanForObject(TokenCompleteTextView.java:755) 
                                                                  at com.tokenautocomplete.TokenCompleteTextView.replaceText(TokenCompleteTextView.java:767) 
                                                                  at android.widget.AutoCompleteTextView.performCompletion(AutoCompleteTextView.java:891) 
                                                                  at android.widget.AutoCompleteTextView.access$500(AutoCompleteTextView.java:91) 
                                                                  at android.widget.AutoCompleteTextView$DropDownItemClickListener.onItemClick(AutoCompleteTextView.java:1192) 
                                                                  at android.widget.AdapterView.performItemClick(AdapterView.java:299) 
                                                                  at android.widget.AbsListView.performItemClick(AbsListView.java:1115) 
                                                                  at android.widget.AbsListView$PerformClick.run(AbsListView.java:2928) 
                                                                  at android.widget.AbsListView$3.run(AbsListView.java:3691) 
                                                                  at android.os.Handler.handleCallback(Handler.java:733) 
                                                                  at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                                  at android.os.Looper.loop(Looper.java:136) 
                                                                  at android.app.ActivityThread.main(ActivityThread.java:5072) 
                                                                  at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                  at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
                                                                  at dalvik.system.NativeStart.main(Native Method) 
savishy commented 8 years ago

This was because I had not fully implemented the Custom View com.vish.TestApp.TokenLayout as per TokenAutoComplete docs.

Now this crash is fixed.