Here is the answer. In this example depending on first spinner second spinner values gets changes. and it will also change the text in the actitivty, which ever value you are selecting in second spinner. If this helps you please vote.
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.text.Html;
import android.view.Menu;
import android.view.View.OnClickListener;
import java.util.ArrayList;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
public s://forum.tuteehub.com/tag/class">class Courses extends Activity {
Spinner s1,s2;
TextView seats_t,t2,hod_det;
ImageView im1;
String s;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.courses);
s1 = (Spinner) findViewById(R.id.grad);
s2 = (Spinner) findViewById(R.id.streams);
seats_t=(TextView)findViewById(R.id.about1);
t2=(TextView)findViewById(R.id.hodname1);
hod_det=(TextView)findViewById(R.id.hoddetails);
im1=(ImageView)findViewById(R.id.hodimage);
t2.
manpreet
Best Answer
2 years ago
Till now I am getting JSON and putting them in 3 different spinners. But the problem is that how to make 2nd spinner data based on the 1st spinner and 3rd spinner data based on the 2nd spinner.