the first spinner is ok, the second spinner is ArrayList, ArrayAdapter<> and it loads a folder of file names, so, im wondering how to use the if() like file name contains,or list item contains, because each of the files either starts with a 62 or a 31.
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
long arg3)
{
switch(arg0.getId())
{
case R.id.spinner:
{
if(arg2 == 0)
{
break;
}
if(arg2 == 1)
{
Intent myIntent = new Intent(Inspector.this, hord.class);
Inspector.this.startActivity(myIntent);
break;
}
if(arg2 == 2)
{
Intent myIntent = new Intent(Inspector.this, hord.class);
Inspector.this.startActivity(myIntent);
break;
}
}
case R.id.recent:
{
if(arg1.getContentDescription().toString().contains("62"))//what im trying to do
{
deviation.setText("jobwelldone");
}
}
}
// TODO Auto-generated method stub
}
Once you have saved your filenames in a String array then you can iterate through the array using the for loop for example and use the
method that searches the calling String object for the String passed to it. For example:
// means that filename String doesn’t contains ’62’ substrng because the indefOf() method returned -1. Otherwise filename String contains ’62’ substring.
To get an item from a spinner:
or use: