android-listview

Disabling focus in TextView

Hello, In an Android application I have a ListActivity. After creating it I have a broadcast receiver which has to disable some items in the list. So I have a pice of code ike this one: View child = getListView().getChildAt(i); child.setEnabled(false); It works in the way it changes the color of the disabled views to gray. But I need...

backgrounds in listview

Hello , i have a listview with a bunch of items in it, each item has its own background, the problem is that if i only have one item in a list, the rest of the "empty" slots of the list is black. I tried applying a background around the listview and also on the view that sorrounds it (relativeView) and i get a strange margin around the w...

How to display list of images in listview from database using android?

In my case i would be retrieving values from sqlite database and have to display it in a list view...So how should i pass the images out from the database into the list view.. I am able to save and retrieve images individually and display it on the screen.But how do i pass a bitmap and display it in a list view.can you help me with some ...

getFirstVisiblePosition() returns wrong value in Gallery View

I have a Gallery view created with a SimpleAdapter that extends BaseAdapter. It contains more items than what it can fit in the screen. So I'm using Gallery.getFirstVisiblePosition() and Gallery.getLastVisiblePosition() to get the first and last visible position. But these functions doesn't always return the correct values especially a...

How to update a CursorAdapter tied to listview when number of items changes?

I have a ListView backed by a custom adapter based on a CursorAdapter. The cursor I give it is based on a list of Notes in the database (each note is a DB row). Everything works just fine until I delete a note from the database. I'm not sure how to properly update the cursor/adapter/listview to display the new data. I've read conflic...

Editing cursor data before ListAdapter displays it in the ListView

I first retrieve information from the SQLite database into a cursor. The cursor contains a timestamp column in the format: yyyy-MM-dd HH:mm:ss.SSS, for example, 2010-08-27 21:25:30.575 Once retrieved, I set aSimpleCursorAdapter like so (code simplified): SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout...

associate custom ID to ListView items.

Is it possible to use a hashmap in ArrayAdapter instanciation ? my "regions" hashmap handles custom ID as keys : Hashmap<ID,Value>. vRegions.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, regions)); the problem here is that ArrayAdapter will call my hashmap's toString() which will print value and disca...

Divider not working in my listview

I am trying to use a gradient divider in my simple listview. But it simply will not work. Divider xml Layout xml <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/masthead_image" android:layout_gravity="center_horizontal" android:src="@drawable/tavi_mh_copy"> ...

Android: Bind data to a ListView without preparing ArrayLists for the ListAdapter?

Right now, I get my Models in a nice object-oriented form. In order to bind them to my List, I have to use the listAdapter. Can I only fill this listAdapter with stupid ArrayLists? Because that means, I have to iterate over my ModelCollection and pull all the data out of my Models again. So, I detach my data from the models and I cant ...

Why is not populating the listView ?

Hello! Im trying to do a very simple thing (showing a populated listView) but im not able. My code is not working and i cant find what's wrong, so i hope someone else can help me :) My XML where i have the listView defined: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android...

Android - Changes in "Style.xml" for Listview font-size

I have defined style for "TabWidget" as below: <style name="MyTheme" parent="@android:style/Theme.Light"> <item name="android:tabWidgetStyle">@style/LightTabWidget</item> </style> <style name="LightTabWidget" parent="@android:style/Widget.TabWidget"> <item name="android:textSize">12px</item> </style> In which i am...

Change dynamically items in a listView

Hello! Im using a custom listView with a Title and a Subtitle where you can read a brief explanation of the item. For each item on the list, im displaying an alertDialog to select an option (different for each case). When the option is selected, i want to change the Subtitle for the option selected by the user. This is what i tried: ...

Using the same view on both tabs in Android

I'm working on an Android application with an activity that uses a tab layout. There are two tabs which switch between the content being shown in a ListView below. This means that the two tab specifications point to the same ListView for content, R.id.main_list: <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent...

Help needed for creating an Android Activity Layout - Screenshot given

Hello Experts, I need to create a screen(scrollable) exactly similar to the screenshot shown here . I have no idea regarding the kind of layout patterns that I should resort to or the widgets that I should use. The data including thumbnail links, is available dynamically. Experts, kindly help with your valuable suggestions, advices a...

Setting visible focus on text view

Hi, I've got listview that in a row it contain 3elements: imageview, textvie and another imageview. I've set my listview to setItemsCanFocus(true) and every item is set setFocusable(false). Screen: http://img252.imageshack.us/img252/4042/zrzutekranue.png I can navigate on the screen (click on text/image, I have those fields set to click...

Displaying list items in ListView

I've got the following main.xml: <?xml version="1.0" encoding="utf-8"?> <AbsoluteLayout android:id="@+id/widget0" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" > <ListView android:id="@+id/listview" android:layout_width="315px" android:la...

listview addFooterView problems

i have content i need to display above my listview and below, so much that a scrollview would be great to use if you could use scrollviews and listviews together. Since thats not the best solution, i've been trying to do a couple of things to add footer content to my listview, here the pic below shows what happens when i add a differen...

Android: list.getCheckedItemPositions() always returns null

Hello, I've created a custom ListView by extending SimpleCursorAdapter. The result is IMAGE + CheckedTextView (Text + Checkbox). After I had issues with the wrong checkboxes getting checked (see here) I had to remove lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); from onCreate. Now I click on a ListItem line and it checks the right ...

Android: XML Layout problems

Hello, I've been trying to create a RelativeLayout with a header, body (list) and footer. I want the header to be above everything (aligned to top), the body (list) to be under the header (when scrolling) and the footer (aligned to bottom) to be above the body (list) - only when it's visible. I've managed to do so PERFECTLY when it com...