Note that there are some explanatory texts on larger screens.

plurals
  1. POOpening different classes by Intent from the OnItemClick. According to the different names in the list
    primarykey
    data
    text
    <p>hey all.. i have been looking at other questions to get help and answers without luck.. my problem is that i want to open different class from my listView. according to the specific name in the listView. . the names are in lv_arr[] .. If anybody can give a detailed answer i will be very thankfull and happy.. Im new in android and not the best in java :-( </p> <pre><code>import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class StatusActivity extends Activity implements OnItemClickListener { public ListView lv1; public String lv_arr[]= {"John", "Andrew","alex","alice","bob","bla bla"}; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tabview); lv1=(ListView)findViewById(R.id.ListView01); lv1.setAdapter(new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1 , lv_arr)); lv1.setOnItemClickListener(this); } public boolean onCreateOptionsMenu(Menu menu) { new MenuInflater(getApplication()) .inflate(R.menu.menu, menu); return(super.onPrepareOptionsMenu(menu)); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.close: super.finish(); break; case R.id.icontext: Intent i = new Intent(this, InfoActivity.class); startActivity(i); break; } return true; } @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // TODO Auto-generated method stub if(position == 0){ //Intent w = new Intent (this, Seekbar.class); //startActivity(w); Toast.makeText(this, "You pressed the first item in the list", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(this, "You pressed all other items in the list", Toast.LENGTH_SHORT).show(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload