Question

I'm trying to use a searchView in my app and i initialized the searcView (from android.support.v7.widget) like this in the onCreateOptionsMenu method (I use android.support.v7.app.ActionBarActivity and )

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_carte, menu);
    SupportMenuItem searchItem = (SupportMenuItem) menu.findItem(R.id.menu_recherche);
    searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    if (mSearchView != null) {
        mSearchView.setOnQueryTextListener(this);
    }
    setupSearchView(searchItem);
    return super.onCreateOptionsMenu(menu);
}

I'have not issues on android 4.4 but in android 2.3 I have this error :

Could not find class 'android.support.v7.widget.SearchView$5', referenced from method android.support.v7.widget.SearchView.addOnLayoutChangeListenerToDropDownAnchorSDK11

Thanks for your help

Was it helpful?

Solution

this problem is caused by png processor in gradle plugin. If you are using android studio change the gradle plugin to 0.9.2. This worked for me

https://code.google.com/p/android/issues/detail?id=67388

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top