0% found this document useful (0 votes)
14 views2 pages

SS7 Mad Prac 8 1

The document contains an XML layout file for an Android application, defining a RelativeLayout with an ImageView, an AutoCompleteTextView for search input, and a Button for initiating a search. Additionally, it includes a Java class for the MainActivity that sets up an ArrayAdapter for the AutoCompleteTextView with predefined string suggestions. The layout and functionality are designed for a user-friendly search interface in the app.

Uploaded by

Soham Kadam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

SS7 Mad Prac 8 1

The document contains an XML layout file for an Android application, defining a RelativeLayout with an ImageView, an AutoCompleteTextView for search input, and a Button for initiating a search. Additionally, it includes a Java class for the MainActivity that sets up an ArrayAdapter for the AutoCompleteTextView with predefined string suggestions. The layout and functionality are designed for a user-friendly search interface in the app.

Uploaded by

Soham Kadam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Input:

Activity_main.xml file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ImageView
android:id="@+id/igm"
android:layout_width="215dp"
android:layout_height="274dp"
android:src="@drawable/googleimage" />
<AutoCompleteTextView
android:id="@+id/txt"
android:layout_width="match_parent"
android:layout_height="94dp"
android:layout_below="@+id/igm"
android:layout_marginLeft="20dp"
android:layout_marginTop="9dp"
android:hint="Search or type web address" />
<Button
android:id="@+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/igm"
android:layout_marginTop="-37dp"
android:text="Search" />
</RelativeLayout>
Java file:
package com.example.prac8_1;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
String
a[]={"Hello","Shashank","MSBTE","Cristiano","Pune","Cricket"};
AutoCompleteTextView t;
Button b;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
t= findViewById(R.id.txt);
b=findViewById(R.id.b1);
ArrayAdapter <String> k = new
ArrayAdapter<String>(this,android.R.layout.select_dialog_item,
a);
t.setAdapter(k);
t.setThreshold(1);
}
}

Output:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy