-3
public class EastContent extends AppCompatActivity implements AdapterView.OnItemClickListener{
public static ArrayList j;
ListView listView;
String s="sonu";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.east_content);
Intent iin= getIntent();
Bundle b = iin.getExtras();
String[] array={"sonu","monu","ronu","sone"};
ArrayList<String> list=new ArrayList();
list.addAll(Arrays.asList(array));
j=b.getStringArrayList("name");
listView= (ListView) findViewById(R.id.listview);
ArrayAdapter adapter=new ArrayAdapter(this,R.layout.customtextview,R.id.textViewcustom,array);
listView.setAdapter(adapter);
listView.setOnItemClickListener(this);
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch (position){
case 0:
Toast.makeText(getApplication(),"good hai",Toast.LENGTH_SHORT).show();
case 1:
Toast.makeText(getApplication(),"achha nahi hai",Toast.LENGTH_SHORT).show();
case 2:
Toast.makeText(getApplication(),"achha cool hai",Toast.LENGTH_SHORT).show();
case 3:
Toast.makeText(getApplication(),"sdvvgsgvrsg",Toast.LENGTH_SHORT).show();
}
}}
Javaの基本:どのように見えるのは、スイッチのケースステートメント.. – Selvin