android null excpetion when starts the activity -


first

  I am using support libraries   

I have BrowseFoods activity

  & lt; Activity Android: name = "BrowseFoods" Android: label = "@ string / app_name" Android: Theme = "@ Style / MyCustomTheme" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "com.Syriatel.BROWSEFOODS" /> & Lt; Category android: name = "android.intent.category.DEFAULT" /> & Lt; / Intent-Filter & gt; & Lt; Meta-Data Android: name = "android.app.searchable" Android: resource = "@xml / searchable" /> & Lt; Meta-Data Android: name = "android.support.PARENT_ACTIVITY" Android: value = ". MainCustomerMenu2" /> & Lt; / Activity & gt;   

And the code for that is:

  Public category BrowseFoods ActionBarActivity Expanded {Public Boolean Submissions Menu (menu menu) {MenuInflater inflater = getMenuInflater (); Int currentTab = mViewPager.getCurrentItem (); If (currentTab == 0) {menu.clear (); Inflater.inflate (R. menu.All_Food, menu); If (Build.VERSION.SDK_INT> = Build.VERSION_CODES.HONEYCOMB) {MenuItem searchItem = menu.findItem (R.id.searchMenuItem); SearchManager searchManager = (SearchManager) getSystemService (Event.SEARCH_SERVICE); Android.support.v7.widget.SearchView searchView = (android.support.v7.widget.SearchView) menu item compat.actactview (searchtime); SearchView.setSearchableInfo (searchManager.getSearchableInfo (getComponentName ())); SearchView.setIconifiedByDefault (wrong); }} And {menu.clear (); Inflater.inflate (R. menu, pyasefood, menu); } Return super. Paraphrase option menu (menu); }}   

In that task, I add two pieces as tab , so when I'm ready for the menu, I'll check which tabs currently on In this way, I know which menu I have to use.

Please refer to the code, I am using the all_food menu, which is:

  & lt; ? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Menu xmlns: Android = "http://schemas.android.com/apk/res/android" xmlns: yourapp = "http://schemas.android.com/apk/res-auto" & gt; & Lt; Item android: id = "@ + id / searchMenuItem" Android: title = "SearchNNSNN" Android: Icon = "@ Android: Drawable / IC_lock_lock" yourapp: ShowAction = "FallActionview | Appletube" Android: actionViewClass = "android.support .v7 .widget.SearchView "/>   

When I run my application, I found the exception:

  02-17 11: 09: 38.384: E / Android Random (5064) : Fatal Exception: Main 02-17 11: 09: 38.384: E / Android Random (5064): android.view.InflateException: Binary XML File Line # 2: Increase in Classroom Error & lt; Unknown & gt; 02-17 11: 09: 38.384: E / Android Random (5064): For Android. View.LayoutInflater.createView (LayoutInflater.java:606) 02-17 11: 09: 38.384: E / Android Time (5064): Com on  
 

note

if I Commenting on these codes

    // searchView.setSearchableInfo (// searchManager.getSearchableInfo (getComponentName ())); // searchView.setIconifiedByDefault (wrong);   

This program works perfectly.

please

change

 < Code> Android: actionViewClass = "android.support.v7.widget.SearchView" />   

to

  yourapp: actionViewClass = "android.support.v7.widget.SearchView" />   

References: View on Action View

OutofMommy Normally occurs when you get older The image you are trying to use. If you come into such error, make sure you scale the image.

Leading to OOM you run out of memory.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -