Android Drop Down List Tutorial Part 2
>> YOUR LINK HERE: ___ http://youtube.com/watch?v=mrcrFY-5c-c
In this android spinner tutorial you will learn how to use android drop down list or android spinner and make it clickable by using spinner setonitemselectedlistener to start a new activity based on any item that you clicked. Let's get started: • First of all this is a continuation to the previous tutorial that will teach the basic stuff on how to work with Android spinner, here is the link: • Android Drop Down List Tutorial • Now to be able to select an item from Android drop down list we need first to call spinner setOnItemSelectedListener • Inside spinner onItemSelected method we will write some code which will allow you to click on the items inside the android spinner and be able to move to another pages based on the item position. • Let's first create those activities and their layout files • Now let's go back to spinner onItemSelected and we will use android startActivity with intent to send the user to another page, it will look something like this: • if (i == 1) { • startActivity(new Intent(MainActivity.this, HomeActivity.class)); • } else if (i == 2) { • startActivity(new Intent(MainActivity.this, WorkActivity.class)); • }else if (i == 3) { • startActivity(new Intent(MainActivity.this, OtherActivity.class)); • }else if (i == 4) { • startActivity(new Intent(MainActivity.this, CustomActivity.class)); • } • That's it :) • Source code is here: https://github.com/codingdemos/Spinne...
#############################