Reputation: 4636
I want to implement the searchable dictionary demo in my app.I have refereed this example from the Android Samples.
What i have tried so far is ...
I have one layout like below ::
Now on click of the Search Image Icon i want to open the view like this..
I have implemented like this so far..
AndroidManifest.xml
<activity
android:name=".home"
android:screenOrientation="portrait" >
<!-- Receives the search request. -->
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<!-- Points to searchable meta data. -->
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable"/>
</activity>
Home.java
imgSearch.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
if (intent.getAction().equals(Intent.ACTION_SEARCH))
{
String query = intent.getStringExtra(SearchManager.QUERY);
//my SearchLogic
{
}
}
Let me know if i am missing anything...
Any help/suggestions will be appreciated... Thanks in advance...
Upvotes: 0
Views: 251
Reputation: 2119
Try to implement this way
textMessage.addTextChangedListener(new TextWatcher(){
public void afterTextChanged(Editable s) {
String query = intent.getStringExtra(SearchManager.QUERY);
//my SearchLogic
//set listview adapter
}
});
Upvotes: 0