Tag: listview

How to load data from server to listview when scrolled?

I have a listview which displays a image and a text. I want display 8 listview rows at a time downloading the data from the server. When the user scrolls the listview i need to download more more data form server and display the items in listview. I have used AsyncTask to Download data from […]

Trying to catch a click on android ListView item: android:descendantFocusability=“blocksDescendants” not working

This has been addressed in many posts on StackOverflow. The most recommended solution is to set: android:descendantFocusability=”blocksDescendants” on the root layout of the list item layout. I’ve done the following. Set android:descendantFocusability=”blocksDescendants” on the root list item layout. Called setDescendantFocusability(BLOCK) on the listView, as well as each listViewItem. Set focus=disabled on the ImageButtons However when […]

Android ListView – stop scrolling at 'whole' row position

Sorry for the confusing title, I cannot express the problem very concisely… I have an Android app with a ListView that uses a circular / “infinite” adapter, which basically means I can scroll it up or down as much as I want and the items will wrap around when it reaches the top or bottom, […]

OnItemLongClickListener is not working in a custom listview

I want context menu to appear after long clicking an item in a custom list view. I am using the ActionBarSherlock. Trying to debug using Toast notifications I have discovered that Long click event is not fired. How to resolve this issue ? m_vwJokeLayout=(ListView)findViewById(R.id.jokeListViewGroup); m_vwJokeLayout.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int […]

How to get selected list items from a Listview with checkBox and Custom Adapter?

I have a ListView with CheckBox on it. and i am using Custom Adapter to populate the ListView. In my xml file i have a Button at bottom. what i want is let user select number of rows in ListView and when he/she clicked on the Button get the position of the selected items so […]

Creating categories in a ListView?

How do I create categories in an arbitrary ListView like those in Preferences (PreferenceCategory)? I’ve found android.R.layout.preference_category that renders that grey TextView but don’t see it mentioned anywhere from java code.

Android ListView with OnItemClickListener AND GestureDetector

I have a the following ListActivity: public class ShowDayActivity extends ListActivity implements OnItemClickListener { private GestureDetector gestureDetector; private View.OnTouchListener gestureListener; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.day); registerForContextMenu(getListView()); gestureDetector = new GestureDetector(new MyGestureDetector()); gestureListener = new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } }; getListView().setOnItemClickListener(this); getListView().setOnTouchListener(gestureListener); } @SuppressWarnings(“static-access”) […]

Height of ListView fills the whole screen, although set as wrap_content

i have this ListView inside a LinearLayout: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:orientation=”vertical” > <TextView …/> <EditText /> … </EditText> <ListView android:id=”@+id/words_list” android:layout_width=”match_parent” android:layout_height=”wrap_content” > </ListView> </LinearLayout> The List is populated programmatically by a SimpleCursorAdapter: adapter = new SimpleCursorAdapter(this, R.layout.list_row_search, mCursor, from, to); list_row_search has a TableLayout with two TableRows: <?xml version=”1.0″ encoding=”utf-8″?> […]

Android: Create ListView in XML?

I want to create a list view with limited set of items that isn’t really going to change. Each row is going to have an image on the left and text on the right. (Just like in the Settings app) Can I populate that in XML (i.e. avoid writing code) ?

Android :EditText loses content on scroll in ListView?

I have list item with EditText in it, I don’t know how many items there will be. I have a problem when I enter some text in EditText, and then scroll down a ListView, after I’ve scroll up again there is no text in my first EditText, or there is some text from other EditText […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.