android layout - i want to implement searchbar concept in my app -
i want implement searcb bar concept in app . when ever user clicks on searbar keyboard buttons need display default searchable button in ..i followed few of links ...but unable searchable bar nor keyboard populated buttons ...
please me in advance .
this searchable.xml placed res/xml
<searchable android:label="@string/app_label" android:hint="@string/search_hint" > </searchable>
and manifest file
<uses-sdk android:minsdkversion="8" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".searchboxactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.search" /> <category android:name="android.intent.category.launcher" /> </intent-filter> <meta-data android:name="android.app.searchable" android:resource="@xml/searchable"/> </activity> </application>
here activity ... package com.hands;
import android.app.activity; import android.app.searchmanager; import android.content.intent; import android.os.bundle;
public class searchboxactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main);
// intent, verify action , query intent intent = getintent(); if (intent.action_search.equals(intent.getaction())) { string query = intent.getstringextra(searchmanager.query); // domysearch(query); } } private void domysearch(string query) { // todo auto-generated method stub system.out.println("hello 2"); }
}
Comments
Post a Comment