Note that there are some explanatory texts on larger screens.

plurals
  1. POClassCastException on SearchView using ActionBarSherlock
    primarykey
    data
    text
    <p>I have a searchview on my app. I can type on the searchbox, however, if I press search the app crashes. It says </p> <p><code>11-25 00:57:09.446: E/AndroidRuntime(1914): java.lang.ClassCastException: com.actionbarsherlock.widget.SearchView cannot be cast to android.widget.SearchView</code></p> <p>However, what I declared on my menu file is correct.</p> <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@+id/search" android:title="Quezon City Guide" android:icon="@drawable/ic_action_search" android:showAsAction="collapseActionView|ifRoom" android:actionViewClass="com.actionbarsherlock.widget.SearchView" /&gt; &lt;/menu&gt; </code></pre> <p>Here is the method where I'm calling it</p> <pre><code>public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.options_menu, (Menu) menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); searchView.setSearchableInfo( searchManager.getSearchableInfo(getComponentName())); return super.onCreateOptionsMenu(menu); } public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.search: return true; default: return super.onOptionsItemSelected(item); } } </code></pre> <p>I don't know what I'm doing wrong.</p> <p>Here are my imports </p> <pre><code> import android.app.SearchManager; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageButton; import android.widget.Toast; import com.actionbarsherlock.widget.SearchView; import com.actionbarsherlock.app.SherlockActivity; </code></pre> <p>Can someone pleas help. Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload