I followed this link for creating search interface. But there was no proper explanation about how to start search activity when clicked on edit text but there is an explanation for only menu items. My interface is in NoActionBarStyle as shown in below code and image
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="perspective.secretbrowser.MainActivity">
<android.support.constraint.ConstraintLayout
android:layout_width="0dp"
android:layout_height="56dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="@color/colorPrimary"
tools:layout_constraintRight_creator="1"
tools:layout_constraintLeft_creator="1"
android:id="@+id/constraintLayout">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/menu_small"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:id="@+id/options"
android:visibility="visible"
android:layout_marginRight="8dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp" />
<ImageView
android:id="@+id/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/tabs_small"
android:visibility="visible"
android:scaleType="fitXY"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
app:layout_constraintRight_toLeftOf="@+id/options"
android:layout_marginRight="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" />
<EditText
android:id="@+id/url_txt"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:background="@drawable/url_bg"
android:hint="@string/search_hint"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tabs"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.333"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp" />
</android.support.constraint.ConstraintLayout>
<com.gc.materialdesign.views.ProgressBarDeterminate
android:id="@+id/progressBar"
android:layout_width="0dp"
android:layout_height="3dp"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@+id/webView"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout" />
<WebView
android:id="@+id/webView"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/progressBar" />
</android.support.constraint.ConstraintLayout>
Suggest me code that will trigger searchactivity when clicked on edittext
Finally found answer
set onclicklistner
on edittext
and trigger search activity using the search(null,false,null,false)
Look here for detailed explaination