Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
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.
Thisismycodefor JSON.try{// Locate the NodeList name
jsonarray = jsonobject.getJSONArray("results");for(int i =0; i < jsonarray.length(); i++){
jsonobject = jsonarray.getJSONObject(i);Results worldpop =newResults();
worldpop.setSyllabus(jsonobject.optString("syllabus"));
worldpop.setGrade(jsonobject.optString("grade"));
worldpop.setSubject(jsonobject.optString("subject"));//worldpop.setFlag(jsonobject.optString("flag"));
world.add(worldpop);
worldlist.add(jsonobject.optString("syllabus"));
worldlist2.add(jsonobject.optString("grade"));
worldlist3.add(jsonobject.optString("subject"));}}catch(Exception e){Log.e("Error", e.getMessage());
e.printStackTrace();}returnnull;}@Overrideprotectedvoid onPostExecute(Void args){// Locate the spinner in activity_main.xmlfinalSpinner mySpinner =(Spinner) findViewById(R.id.syllabus);Spinner mySpinner2 =(Spinner) findViewById(R.id.grade);Spinner mySpinner3 =(Spinner) findViewById(R.id.subject);// Spinner adapterLinkedHashSet<String> listToSet =newLinkedHashSet<String>(worldlist);//Creating Arraylist without duplicate valuesfinalList<String> worldlistnew =newArrayList<String>(listToSet);
mySpinner
.setAdapter(newArrayAdapter<
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.
No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that
you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice
sessions to improve your knowledge and scores.
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.