android-viewbinder

Android ImageButton in ListView row clicklistener not responding

ε祈祈猫儿з 提交于 2019-12-13 05:19:23
问题 I have a ListView with rows that contain ImageButtons (shown as 'O' below): [<-------TextView-------> O O O] [<-------TextView-------> O O O] I am finding that the first row has intermittent behaviour. At first it appeared that the image button onclicklisteners were not being called for just the top row. What I have found is that the onclicklisteners for the buttons do get called, but the clicks seem to be queued/buffered until I click on the row itself. I will happily post some code if

ViewBinder creates random content

情到浓时终转凉″ 提交于 2019-12-11 19:32:27
问题 I have strange behavoir in a ViewBinder. All works good on TextViews. With CheckBoxes (removed in my code) and custom widgets progressChart the values are not stored in the right postion of the List when I scroll down and/or up again. All seems very random. But TextViews are always correct. Here is my code: SimpleAdapter.ViewBinder viewBinder = new SimpleAdapter.ViewBinder() { @Override public boolean setViewValue(View view, Object data, String textRepresentation) { if (view.getId() == R.id

SQLite BLOB column to SimpleCursorAdapter with ViewBinder

≯℡__Kan透↙ 提交于 2019-12-11 17:53:28
问题 I'm trying to display a list of contacts that are currently stored in a SQLiteDatabase . Previously I've retrieved ContactsContract.Contacts.PHOTO_THUMBNAIL_URI and stored it in a form of byte[] in the BLOB column of my database rows. Now when I'm trying to extract the thumbnails back, by decoding them to Bitmaps in MyBinderView class, the pictures don't appear, instead I see empty spaces(the default image, ic_launcher , is showed correctly). My ListView row layout: <?xml version="1.0"

Using ViewBinder for a custom ListView item with TextView

天涯浪子 提交于 2019-12-11 04:14:45
问题 I'm trying to add a background color for an TextView on my ListView using a SimpleCursorAdapter with ViewBinder , but it doesn't work: listrow.xml: <TextView android:id="@+id/catcolor" android:layout_width="4dp" android:layout_height="match_parent" android:layout_margin="4dp" android:background="#FF0099FF" /> <LinearLayout android:paddingTop="4dp" android:paddingRight="4dp" android:paddingLeft="4dp" android:paddingBottom="2dp"> <TextView android:id="@+id/title" android:text="{title}" android

Custom list clicking with checkboxes

烂漫一生 提交于 2019-12-08 23:56:35
问题 I've populated a ListActivity from a Cursor using SimpleCursorAdapter that starts another activity when one of the list items have been clicked. I'm also using ViewBinder to do some custom transformation of the data. I want to add a CheckBox to each row in the list so I've changed the view and added a CheckBox with gravity right. Adding the CheckBox has removed the ability to click on the items. The onListItemClick method I was overriding in ListActivity is no longer called when you press on

ViewBinder setViewValue for ListView item leads to multiple CheckBoxes checked

丶灬走出姿态 提交于 2019-12-08 11:52:37
问题 I'm using a ListView which has: list item click CheckBox click I can save the cursorPosition by using view.setTag(cursor.getPosition()) and I can take necessary action on the checked item but when I scroll down, I see several other CheckBoxes checked(visual only). As a work around I tried setting the view description, saving CheckedBox view ids in list and then iterate to see if CheckBox needs to be shown as checked. But views appear to be reused as I scroll down(same view ids). How can I

Problems with the ViewBinder

断了今生、忘了曾经 提交于 2019-12-08 07:24:38
问题 I need to display a ListView with some images, and I'm using the following code: dataText = (TextView)findViewById(R.id.data); dataText.setText(camping.stringIn + " >> " + camping.stringOut); l = name.length; ArrayList<tipologia> tipologieList=new ArrayList<tipologia>(); tipologia[] tip = new tipologia[l]; for (int i = 0; i < l; i++) { int rand = new Random().nextInt(3); availability[i] = String.format("%d", rand); tip[i] = new tipologia(image[i]); } for(int i=0; i<tip.length; i++) {

how to bind a checkbox to a listview

痞子三分冷 提交于 2019-12-02 03:46:20
问题 I have a listview containing on each row a textview with a checkbox, so when the checkbox is checked and we scroll down through the listview the checkbox instance will be taken from a place to another (reused..) and I have several checked checkboxes how to fix that I tried to bind the checkbox to the listview but that didn't work my code is: SimpleCursorAdapter adapter =new SimpleCursorAdapter(this,R.layout.rating,cu,new String[]{"Title","Favorites"}, new int[]{R.id.text1,R.id.bt_rating}

SimpleCursorAdapter and ViewBinder - Binding data to ListView items to be retrieved on click

狂风中的少年 提交于 2019-12-01 22:19:26
So I've got a ListView (using a ListActivity ) that I'm populating from a SQLiteDatabase . I'm trying to attach the ID (PK) of the row to the view, so that onListItemClick of each list item, I can do stuff with that ID. I've read that arbitrary data can be set to a View using setTag and retrieved with getTag (I haven't actually had this work successfully yet, so this may be the problem). Here's a pared down version of what I'm using (for simplicity/brevity): public class Favorites extends ListActivity { public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState);

How to use SimpleAdapter.ViewBinder?

随声附和 提交于 2019-12-01 01:27:23
I have a list with a complex layout R.layout.menu_row . It consists of a ProgressBar and a text field. The adapter I use: SimpleAdapter simpleAdapter = new SimpleAdapter(this, getData(path), R.layout.menu_row, new String[] { "title", "progress" }, new int[] { R.id.text1,R.id.progressBar1}); The adapter knows how to handle TextViews by it self but not ProgressBars , so I wrote a complex data binder: SimpleAdapter.ViewBinder viewBinder = new SimpleAdapter.ViewBinder() { @Override public boolean setViewValue(View view, Object data, String textRepresentation) { //here goes the code if () { return