listviewitem

How do I disabled (dim) an option in onItemLongClick from a ListView in Android?

When an item in my ListView is clicked, I have several options pop up in a dialog for the user to choose. However, there are varying scenarios where I'd like to disable one or more options so the user cannot choose them. Here's some code. public class MyApp extends ListActivity implements OnItemClickListener, OnItemLongClickListener { ...

What calls ListViewItem_ItemChecked event?

I have a ListView, checkboxes = true, View = List. On the start of the project, I go through, do some calculatations and determine if the database is empty and what I should do from there. Well one thing I do is iterate through an array (from a dll) of Report Names and add the list view items to the ListView because we want it to be as...

How can I modify the background of a ListItem when it has been selected?

I have a ListView with a bunch of ListItem's. When the user selects an item, I would like to change that ListItem's background to an image. How can I accomplish this? listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> a, View v, int position, long id) { // how do I ch...

ListView selector problem: Selection does not get removed

I have a ListView. When I click on a ListItem, I set the background of the ListItem (it's view) to another color: listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> a, View v, int position, long id) { setupDetailView(position)...

ListViewItem does not get highlighted if the background isn't transparent

I have a ListViewItem with a custom gradient background. The default selector no longer highlights these rows anymore. Highlight only works if I set the background to transparent. How can I get the highlight? <ListView android:id="@+id/symbolsListView" android:layout_width="fill_parent" android:background="@drawable/transparent_...

Problem setting ListView selector color when pressed

I have the following ListView, and have followed the answer from this SO Question w/ no luck: http://stackoverflow.com/questions/2038040/android-listview-selector-color <ListView android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" and...

How to define ColorStateList for TextView?

When my ListViewItem is highlighted, I want the text to turn white. How can I define this? <selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; <item android:state_focused="true" android:color="@color/testcolor1"/> <item android:state_pressed="true" android:state_enabled="false" android:color="@color/testcolor2...

ListView separators using a CursorAdapter

I have a ListView which is populated using a CursorAdapter. I'd also like to have some separators in my ListView. I have accomplished this with an ArrayAdapter, but I'm not sure how to accomplish this with a CursorAdapter. Are there any strategies for doing so? Or am I out of luck? ...

Storing data on ListView item

First of all I'm new to Anroid. So it might be a very simple question but I couldn't find the answer by myself. I have two Activity, I'm filling the first one with the user names and the other data I receive from the remote request and the second one is being used to display the details of the selected user. So in some way I need to as...

Android:To set an item as selected when the ListView opens?

Hi, An activity has a Button and a ListView. Initially, only the Button is visible. When the button is pressed, the ListView is displayed. When displayed, is it possible for me to show one particular item as selected/focussed? A use case could be that suppose it is a list of language settings and when the list opens, the currently sel...

listview virtual list, e.ItemIndex crashing!

Hello, the problem is probably simple, the post is longer than I wished, but I've tried providing as much info and detail as possible. I didn't write this GUI app, nor designed, however like most of us I've inherited it. It had a (regular) ListView, actually the app has several ListView(s), not sure if that matters yet. Because the # o...

Android: How to read a number as int from a String; basically to read Text of a ListViewItem?

Hi, This is my problem. I have a ListView, each row is a CheckedTextView. The list view items are "1", "2" and "3". When a ListItem is clicked, I want to read the number and assign it to an int variable. I did the following to read the Text of the clicked item: onItemClick(AdapterView<?> parent, View v, int position, long id) { ...

Android Custom ListView selected item children?

I have a custom listview row that contains a number of textView components. Instead of the "standard" single text item, I have created a item where each listview row contains several bits of information. For this example, I have a record id, a name, and a description for each row in the listview. I have my listview populated via thi...

listview item indexing

I am using a listview with 6 items per page. When I choose an item from the 6 items it should take me to a page with 3 items per page BUT the selected item (on previous page) as FIRST item in the list on the new page. Basically how do I set which items shows first in the listview? Is that a property? ...

"Object reference not set to an instance of an object." when setting a listview template.

I'm trying to switch between 2 templates on the basis of a data trigger. But I app crashes with the "Object reference not set to an instance of an object." If I comment out the setter for the template it runs fine. Here's my XAML: <Style x:Key="ListViewItemStyle" TargetType="{x:Type ListViewItem}"> <Setter Property="Template" V...

Specified items will not be deleted when using ListView.Item.RemoveAt()

I have tried to remove specific items from a listview using the RemoveAt() method. But When I remove it the first time some items will stay. For example: see the image below Code: private void button1_Click(object sender, EventArgs e) { for (int i = 0; i < listView1.Items.Count; i++) { if (listView...

derived from ListView, not painting correctly.

I had a regular Forms.ListView and converted it to Virtual list. Implemented the RetrieveVirtualItem and everything was working fine. Then I decided that I'll add cache and eventually I'll need sorting and who knows what else. Since I've inherited the code and it was already somewhat messy, I decided to yank my changes and move them to ...