In my sample program in 1stscreen i have one input field,based on this input i have to show a list view(which is another activity)how can i implement that.I am new to android.Here is my code.
This is after clicking button:
if(text1.getText().toString().equals("subbu"))
{
startActivity(new Intent(Listview));
// Toast.makeText(Sampleprojectsubbu1Activity.this,"Name:"+text1.getText().toString(), Toast.LENGTH_LONG).show();
}
This is the list to be shown:Just for sample i have given some unwanted array.
public class Listview extends ListActivity
{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, COUNTRIES));
}
static final String[] COUNTRIES = new String[]
{
"XXXXX","YYYYYY"
};
}
Wrong:
Correct way to start Activity:
Update:
To understand more about Intent, check and read below articles: