/* Copyright 2014 ESRI
 *
 * All rights reserved under the copyright laws of the United States
 * and applicable international laws, treaties, and conventions.
 *
 * You may freely redistribute and use this sample code, with or
 * without modification, provided you include the original copyright
 * notice and use restrictions.
 *
 * See the Sample code usage restrictions document for further information.
 *
 */

package com.arcgis.android.samples.search.placesearch;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.view.MenuItemCompat;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.SearchView;

import com.esri.android.map.MapView;


public class MainActivity extends Activity {

    MapView mMapView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // after the content of this activity is set
        // the map can be accessed from the layout
        mMapView = (MapView)findViewById(R.id.map);

        // set logo and enable wrap around
        mMapView.setEsriLogoVisible(true);
        mMapView.enableWrapAround(true);

    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);

        MenuItem searchItem = menu.findItem(R.id.action_search);
        SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);

        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

@@ -513,64 +513,83 @@
 oid.
-os.Bundle;%0Aimport android.support.v4.view.MenuItemCompat
+app.SearchManager;%0Aimport android.content.Context;%0Aimport android.os.Bundle
 ;%0Aim
@@ -1456,83 +1456,297 @@
     
-MenuItem searchItem = menu.findItem(R.id.action_search);%0A        SearchView
+// Get the SearchView and set the searchable configuration%0A        SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);%0A        SearchView searchView = (SearchView) menu.findItem(R.id.action_search);%0A        // Current activity is search activity%0A       
  sea
@@ -1756,63 +1756,186 @@
 View
- = (
+.set
 Search
-View) MenuItemCompat.getActionView(searchItem
+ableInfo(searchManager.getSearchableInfo(getComponentName()));%0A        // Do not iconify the widget; expand it by default%0A        searchView.setIconifiedByDefault(false
 );%0A%0A

configure the search widget