Ex.No:6 Build a program to create a first display screen of any search engine using Auto Complete Text View.
To develop a program to create a first display screen of any search engine using AutoComplete TextView in Android Studio.
Android Studio(Min.required Artic Fox)
Open Android Stdio and then click on File -> New -> New project.
Then type the Application name as searchengine and click Next.
Then select the Minimum SDK as shown below and click Next.
Then select the Empty Activity and click Next. Finally click Finish.
Design layout using AutoComplete TextView in activity_main.xml.
Display screen of search engine in MainActivity file.
Save and run the application.
Program to print the text “display screen of any search engine”.
Developed by: SURYA R
Registeration Number : 212220230052
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical"
android:padding="16dp"
android:background="@drawable/th"
tools:context=".MainActivity">
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
android:text="search"/>
<TextView
android:id="@+id/textview1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="sans-serif-black"
android:textSize="36sp"
android:textColor="#FDD835"
android:textColorHighlight="#4CAF50"
android:textColorHint="#03A9F4"
android:textColorLink="#E91E63"
android:textStyle="italic" />
</LinearLayout>
package com.example.autotext;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity {
AutoCompleteTextView text;
String[] words={"Apple","android","aerospace","alien","buffalo","cat","dog","elephant","ironman","idk","i","python","kit","lick","sight","tick","zebraz"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
text = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView);
ArrayAdapter adapter = new
ArrayAdapter(this, android.R.layout.simple_list_item_1, words);
text.setAdapter(adapter);
text.setThreshold(1);
}
}
Thus a Simple Android Application develop a program to create a first display screen of any search engine using AutoComplete TextView in Android Studio is developed and executed successfully.