I am trying to use the autocompletetextview in Android Studio to provide suggestions for every letter keyed-in by the user.
Every time a letter is keyed-in, an API call is made like this,
http://dev.markitondemand.com/MODApis/Api/v2/Lookup/json?input=app
http://dev.markitondemand.com/MODApis/Api/v2/Lookup/json?input=appl
http://dev.markitondemand.com/MODApis/Api/v2/Lookup/json?input=apple
The JSON array that's returned from the API call is populated in the suggestions list-box.
So far I got the activity_main.xml file like this,
<?xml version="1.0" encoding="utf-8"?>
<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="com.example.raam.stockmarketviewer.MainActivity">
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/stocks"
android:hint="@string/hint" />
</RelativeLayout>
After this how should I structure the MainActivity.java file to accomplish the auto-suggestions feature?