Tag Archives: ListView

954 views

ListView set the item as checked to be highlighted

Important: Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB int layout = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ? android.R.layout.simple_list_item_activated_1 : android.R.layout.simple_list_item_1; getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); getListView().setItemChecked(position, true); Example of usage:   public void updateList() { Context ctx = getActivity(); Notes notes = new Notes(ctx);   String[] from = { Notes.COLUMN_TITLE … Continue reading

Posted in Android Examples Code | Tagged , | Comments Off on ListView set the item as checked to be highlighted
52,398 views

Start Activity from ListView item click Android example

How start certain Activity if user clicked to ListView item Start Activity from list – launches other activities from list – latest variant!!!! public class Main extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);   try { setContentView(R.layout.main); … Continue reading

Posted in Android Examples Code | Tagged , , , , , , | Comments Off on Start Activity from ListView item click Android example
8,367 views

ListView add item click item basic Android example code

Definition of ListView in layout main.xml file Android example   <ListView android:id="@+id/idListView" android:background="#7700CC00" android:layout_height="wrap_content" android:layout_width="fill_parent" /> Code in Main.java ListView example source code Java Android public class Main extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);   … Continue reading

Posted in Android Examples Code | Tagged , , , | Comments Off on ListView add item click item basic Android example code