title: how to make switch case click by array?
body: <p>Please help me, how to make switch case click by array or how to make this switch case become if? because I have a searchbar, and when doing a search, the items that came out not in accordance with the array. for example when i clicking the item/array of es cendol, then the class shown is EsBerasKencur_ResepMinum.class, not EsCendol_ResepMinum.class. but the toast display showing items es cendol. please help me.</p>
  
  <pre><code>public class Dingin_Tab extends Activity implements
      OnItemClickListener {
  
  public static final String[] titles = new String[] { "Es Beras Kencur", "Dawet Ayu", 
      "Es Cendol", "Es Doger", "Es Oyen", "Es Teler", "Es Temulawak", 
      "Es Selendang Mayang", "Es Cincau", "Es Merah Delima"};
  
  public static final Integer[] images = {R.drawable.minumberaskencur, 
      R.drawable.minumdawetayu, R.drawable.minumescendol,
      R.drawable.minumesdoger, R.drawable.minumesoyen, R.drawable.minumesteler, R.drawable.minumestemulawak, 
      R.drawable.minumesselendangmayang, R.drawable.minumescincau, R.drawable.minumesmerahdelima};
  
  ListView listView;
  List&lt;RowItem&gt; rowItems;
  EditText editsearch;
  ListView list;
  CustomListViewAdapter madapter;
  ArrayList&lt;RowItem&gt; arraylist = new ArrayList&lt;RowItem&gt;();
  
  
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.listviewresma);
  
      rowItems = new ArrayList&lt;RowItem&gt;();
      for (int i = 0; i &lt; titles.length; i++) {
          RowItem item = new RowItem(images[i], titles[i], null);
          rowItems.add(item);
  
      }
  
      listView = (ListView) findViewById(R.id.list);
      CustomListViewAdapter adapter = new CustomListViewAdapter(this,
              R.layout.list_item, rowItems);
  
      listView.setAdapter(adapter);
      listView.setOnItemClickListener(this);
  
      madapter = new CustomListViewAdapter(this, 0, rowItems);
  
      // Binds the Adapter to the ListView
      listView.setAdapter(madapter);
  
      // Locate the EditText in listview_main.xml
      editsearch = (EditText) findViewById(R.id.search);
  
      // Capture Text in EditText
      editsearch.addTextChangedListener(new TextWatcher() {
  
          @Override
          public void afterTextChanged(Editable arg0) {
              // TODO Auto-generated method stub
              String text = editsearch.getText().toString().toLowerCase(Locale.getDefault());
              madapter.filter(text);
          }
  
          @Override
          public void beforeTextChanged(CharSequence arg0, int arg1,
                  int arg2, int arg3) {
              // TODO Auto-generated method stub
          }
  
          @Override
          public void onTextChanged(CharSequence arg0, int arg1, int arg2,
                  int arg3) {
              // TODO Auto-generated method stub
          }
  
  });
  }
  
  @Override
  public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position,
          long id) {
  
      switch (position)
      {
          case 0:  Intent newActivity0 = new Intent(this, EsBerasKencur_ResepMinum.class);     
              startActivity(newActivity0);
              break;
          case 1:  Intent newActivity1 = new Intent(this, DawetAyu_ResepMinum.class);     
              startActivity(newActivity1);
              break;
          case 2:  Intent newActivity2 = new Intent(this, EsCendol_ResepMinum.class);     
              startActivity(newActivity2);
              break;
          case 3:  Intent newActivity3 = new Intent(this, EsDoger_ResepMinum.class);     
              startActivity(newActivity3);
              break;
          case 4:  Intent newActivity4 = new Intent(this, EsOyen_ResepMinum.class);     
              startActivity(newActivity4);
              break;
          case 5:  Intent newActivity5 = new Intent(this, EsTeler_ResepMinum.class);     
              startActivity(newActivity5);
              break;
          case 6:  Intent newActivity6 = new Intent(this, Temulawak_ResepMinum.class);     
              startActivity(newActivity6);
              break;
          case 7:  Intent newActivity7 = new Intent(this, EsSelendangmayang_ResepMinum.class);     
              startActivity(newActivity7);
              break;
          case 8:  Intent newActivity8 = new Intent(this, EsCincau_ResepMinum.class);     
              startActivity(newActivity8);
              break;
          case 9:  Intent newActivity9 = new Intent(this, EsMerahDelima_ResepMinum.class);     
              startActivity(newActivity9);
              break;
      }           
      Toast toast = Toast.makeText(getApplicationContext(),
          "Resep Minuman Dingin " + (position + 1) + ": " + rowItems.get(position),
          Toast.LENGTH_SHORT);
      toast.setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 0);
      toast.show();
  }
  </code></pre>