Task 1. Add Search

1.1. Add an Options Menu with Search item

<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app = "http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.android.example.wordlistsqlsearchable.MainActivity">

<item
android:id="@+id/action_search"
android:title="Search..."
android:orderInCategory="1"
app:showAsAction="never" />
</menu>
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_search:
return true;
}
return super.onOptionsItemSelected(item);
}

1.2. Create the layout for the search activity

1.3. Add an Activity for searching

public class SearchActivity extends AppCompatActivity {

private static final String TAG = EditWordActivity.class.getSimpleName();

private TextView mTextView;
private EditText mEditWordView;
private WordListOpenHelper mDB;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search);

mEditWordView = ((EditText) findViewById(R.id.search_word));
mTextView = ((TextView) findViewById(R.id.search_result));
mDB = new WordListOpenHelper(this);
}
}
<activity
android:name="com.android.example.wordlistsqlsearchable.SearchActivity">
</activity

1.4. Trigger SearchActivity from the menu

Intent intent = new Intent(getBaseContext(), SearchActivity.class);
startActivity(intent);

1.5. Implement the onClick handler for the Search button in the SearchActivity

1.6. Implement the search method in WordListOpenHelper

learn by your self :)