'How to show a different set of list depending on the first AutoCompleteTextView value?

courseCompletetextView = (AutoCompleteTextView) findViewById(R.id.course);

String CourseCompleteTextView = courseCompletetextView.getText().toString().trim();

autoCompleteTextView = findViewById(R.id.dept);

Context context = getApplicationContext();

String[] departments = context.getResources().getStringArray(R.array.depts);

ArrayAdapter<String> itemAdapter = new ArrayAdapter<>(this, R.layout.depts_list, departments);

autoCompleteTextView.setAdapter(itemAdapter);


if(CourseCompleteTextView.equals("College of Information Technology Education")){
     
String[] citeCourses = context.getResources().getStringArray(R.array.cite);
     
ArrayAdapter<String> itemCourses = new ArrayAdapter<>(this, R.layout.course_list, citeCourses);
     
courseCompletetextView.setAdapter(itemCourses);
}

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source