Breaking News


Monday 30 December 2013

AUTO TEXT ANDROID TUTORIAL

AUTO TEXT ANDROID TUTORIAL


First Create main.xml file....

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="24dp"
        android:text="City :"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <AutoCompleteTextView
        android:id="@+id/auto"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/textView1"
        android:layout_alignBottom="@+id/textView1"
        android:layout_alignParentRight="true"
        android:textColor="@android:color/black"
        android:ems="10" >

       
    </AutoCompleteTextView>

</RelativeLayout>


After create MainActivity.java file....

public class MainActivity extends Activity {
String co[] = {"Nishal","Niky","Nikunj","Sachin","Sahil","Sanjay"}; // here enter your value

AutoCompleteTextView at;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);


at = (AutoCompleteTextView)findViewById(R.id.auto);
at.setAdapter(new ArrayAdapter<String>(this,R.layout.list,co));
}



}

OUTPUT :-

WRITE YOUR STING VALUE IN EDIT TEXT AFTER FILTER EDIT TEXT.....


Auto Text
OUTPUT




Share This
Blogger
Facebook
Disqus

comments powered by Disqus

No comments :

Post a Comment

Subscribe
Labels
Popular Posts

Subscribe Via Email

About Us

THIS IS ANDROID AND JAVA FREE TUTORIAL AND ALL PROVIDE SOLUTION IN ANDROID AND JAVA INTERVIEW QUE AND ANS IS AVAILABLE IN MY BLOG AND ANY QUERY PLEASE CONTACT ME GO NOW CONTACT US PAGE.

Total Pageviews

© Android and Java solution All rights reserved | Designed By Fireandroids