Hello, for anyone with good experience using android studio, I would like help i
ID: 3873569 • Letter: H
Question
Hello, for anyone with good experience using android studio, I would like help in creating a simple search application. I would like to have an app where a user can type in a name or number, and it will display a certain amount of relevant results (that are stored from a list of dummy results) For example, from a list of names "David Grove, Alice brown, Chase Stewart, Ryan Grove" If the user types in "Grove", both David Grove and Ryan Grove will appear in the results (with an extra field that allows details about each individual) Please send all the code (.JAVA .XML etc.) as I need to test run it on my Android Studio as well to make sure it works. Steps would be greatly appreciated as well, as I would like to build from this template and understand the coding/framework behind it. Thank you.
Explanation / Answer
Following is mainactivity file. package com.example.chegg; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; public class MainActivity extends Activity { AutoCompleteTextView autocomplete; String[] arr = { "David Grove", "Alice brown","Chase Stewart","Rya Grove"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); autocomplete = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1); ArrayAdapter adapter = new ArrayAdapter (this, android.R.layout.select_dialog_item, arr); // setThreshold is a character user have to type to show drop down. autocomplete.setThreshold(1); autocomplete.setAdapter(adapter); } } Following is activity_main file: Following is strings.xml file: Search Application Enter name Following is the manifest.xml file:Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.