---
title: "Show hint in search widget actionBar andorid"  
description: "Show hint in search widget actionBar andorid"  
author: "Anonymous User"  
published: 2015-12-24  
updated: 2015-12-24  
canonical: https://www.mindstick.com/forum/33783/show-hint-in-search-widget-actionbar-andorid  
category: "android"  
tags: ["android"]  
reading_time: 3 minutes  

---

# Show hint in search widget actionBar andorid

I have a [Search](https://www.mindstick.com/articles/65368/best-smo-services-company-in-hyderabad-improve-search-rankings) Widget within an [Action](https://www.mindstick.com/forum/155752/what-is-action-result-with-its-types) Bar. I have set up an [android](https://www.mindstick.com/articles/13046/10-reasons-why-i-prefer-android-vs-iphone-ios):hint [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) however It is not [showing up](https://answers.mindstick.com/qa/95500/why-are-my-favorites-not-showing-up-in-safari) when I click on the Search Icon.\
My [Activity](https://www.mindstick.com/forum/12894/how-to-force-recreation-of-activity-fragment-on-restore) [Class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) and Xml layouts: \

```
MainActivity.java package com.example.myApp;import android.os.Bundle;import android.app.ActionBar;import android.app.Activity;import android.app.SearchManager;import android.content.Context;import android.view.Menu;import android.widget.SearchView;public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentView(R.layout.activity_main);    //creates an action bar.     ActionBar actionBar = getActionBar();    //sets the homebutton.     actionBar.setDisplayHomeAsUpEnabled(true);}@Overridepublic boolean onCreateOptionsMenu(Menu menu) {    // Inflate the menu; this adds items to the action bar if it is present.    getMenuInflater().inflate(R.menu.main, menu);    // Associate searchable configuration with the SearchView    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);    SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));    return true;  }   }
```

\
\
Menu Xml: Main.xml => res/menu/Main.xml\

```
<menu xmlns:android="http://schemas.android.com/apk/res/android">    <item android:id="@+id/search"          android:title="@string/search_title"          android:icon="@drawable/ic_search"          android:showAsAction="collapseActionView|ifRoom"          android:actionViewClass="android.widget.SearchView"                 /></menu>
```

\
Search Xml

```
searchable.xml => res/XML/searchable.XMl <?xml version="1.0" encoding="UTF-8"?>    <searchable xmlns:android="http://schemas.android.com/apk/res/android"        android:label="@string/app_name"        android:hint="search"        android:textColorHint= "#FF0000"          />  
```

\
\
Mainfest.XMl\

```
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.example.MyApp"    android:versionCode="1"    android:versionName="1.0" >    <uses-sdk        android:minSdkVersion="11"        android:targetSdkVersion="17" />    <application        android:allowBackup="true"        android:icon="@drawable/ic_launcher"        android:label="@string/app_name"        android:theme="@style/AppTheme" >        <activity            android:name="com.example.MyApp.MainActivity"            android:label="@string/app_name" >             <meta-data android:name="android.app.searchable"            android:resource="@xml/searchable" />            <intent-filter>                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>        </activity>    </application></manifest>
```

\
\
My action-bar has a black [background](https://www.mindstick.com/articles/65/how-to-change-background-color-of-tab-control-in-c-sharp) so I assumed that I initially could not see the :hint value as the hint [text color](https://www.mindstick.com/forum/158651/what-is-the-css-property-used-to-change-the-text-color-of-an-element) is black is as well. However even after changing the hintTextColor, I still can not see the hint value.\
Please help, Why it is not showing ?

## Replies

### Reply by Anonymous User

or some reason you need to put <action android:name="android.intent.action.SEARCH"/> inside your tag. That's what fixed the problem for me. But be careful to put it in this order\

```
<intent-filter>       <action android:name="android.intent.action.SEARCH"/>       <action android:name="android.intent.action.MAIN" />       <category android:name="android.intent.category.LAUNCHER" /></intent-filter>
```

otherwise your activity won't be recognized as launcher.


---

Original Source: https://www.mindstick.com/forum/33783/show-hint-in-search-widget-actionbar-andorid

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
