I am making a ui portal. in that portal i want to make multiuser login system so that different people have a different login page and a different sequential page.
this is how my initial page looks like
Can someone help me in how can I make that kind of system where if i click 'student/visitor' it gives me one login page and if i click something else then it gives me a different login page.
'''public class MainActivity extends AppCompatActivity {
String[] items = {"Student/Visitor","Teacher","Administrator","Building Executive"};
AutoCompleteTextView autoCompleteTxt;
ArrayAdapter<String> adapterItems;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
autoCompleteTxt = findViewById(R.id.auto_complete_text);
adapterItems = new ArrayAdapter<String>(this,R.layout.list_item,items);
autoCompleteTxt.setAdapter(adapterItems);
autoCompleteTxt.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String item = parent.getItemAtPosition(position).toString();
Toast.makeText(getApplicationContext(),"Item: " item, Toast.LENGTH_SHORT).show();
}
});
}
this is the code of my main activity.
CodePudding user response:
So basically you want to implement profiling in the application. For that you can define the access roles likes if a student will login , he can access only those options which are defined for that. you can define some codes for each like for student 1 and for teacher 2
autoCompleteTxt.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String item = parent.getItemAtPosition(position).toString();
Toast.makeText(getApplicationContext(),"Item: " item, Toast.LENGTH_SHORT).show();
if(position==1)
student login ui page
}
else if(position==2)
teacher login ui pagge
});