android-listview

Dynamically add items to list view using custom adapter for Android app

帅比萌擦擦* 提交于 2019-12-21 07:09:24
问题 So, right now I have a custom adapter class that takes in an array of Locations and adds them to a ListView. This is all fine and dandy, but I would like to add Locations to this listview after this initialization. For example, someone can "add a Location" and it will add it to this ListView. Here is my Main Activity: package com.example.listviewtest; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.ListView; public class MainActivity

How do I remove the divider from a listview on android? [duplicate]

时间秒杀一切 提交于 2019-12-21 06:48:25
问题 This question already has answers here : How do I remove lines between ListViews on Android? (12 answers) Closed 5 years ago . I'm developing a app that have a Listview , and the items from list already have a style I don't need the divider. How do I set as hidden or remove the divider from the ListView ? 回答1: You can try android:divider="@null" . 回答2: There are different ways to achieve this, but I'm not sure which one is the best (I don't even know is there is a best way). I know at least 2

Using simpleAdapter with image for listview

泄露秘密 提交于 2019-12-21 06:10:00
问题 I have a little problem with putting an image to a list view using simple adapter. I'm getting the image from my online server(AMAZON). After downloading the image based on the user id, i try to set them in my listview but nothing was display and no error is occured. Below is my code: // looping through All applicants for (int i = 0; i < applicant.length(); i++) { JSONObject c = applicant.getJSONObject(i); // Storing each JSON item in variable String uid = c.getString(TAG_UID); String name =

Using simpleAdapter with image for listview

 ̄綄美尐妖づ 提交于 2019-12-21 06:07:04
问题 I have a little problem with putting an image to a list view using simple adapter. I'm getting the image from my online server(AMAZON). After downloading the image based on the user id, i try to set them in my listview but nothing was display and no error is occured. Below is my code: // looping through All applicants for (int i = 0; i < applicant.length(); i++) { JSONObject c = applicant.getJSONObject(i); // Storing each JSON item in variable String uid = c.getString(TAG_UID); String name =

ListView item coloring on selection not working properly in android API version 8/9

 ̄綄美尐妖づ 提交于 2019-12-21 05:49:09
问题 I'm currently using a ListView to display a sort of items. I've implemented an action mode to select multiple items and to delete massively that works well in android 4.x. But when I tried with API version 8 or 9 (android 2.2.x/2.3.x), selection works internally as expected but row items are colored randomly. If user selects first row, internally first row is selected, but row number 4 is colored. When I click another row, this row and first one is colored. It's a strange behaviour which I

ListView with a (half- and or) hidable header

允我心安 提交于 2019-12-21 05:41:26
问题 My Problem, is that I don't even know what to search for. I want a ListView. This ListView has some Elements with a "sticky" state. If I scroll down the List on the device, I want that all ListElements with state "sticky", to be sticky ontop of the list (non-scrollable) till there is another one "pushing it away". The rest of the elements are supposed to scroll as normal. I've seen that kind of List in the Google Market. If you have a big screen you can see that list on the Detailview of any

Android ListView Background not painted

筅森魡賤 提交于 2019-12-21 05:15:10
问题 I'm working on the UI for an application I'm writing but I've hit a bit of a wall and wonder if there is anyone out there can give me some advice. I've created a ViewFlipper to slide between two ListViews. It works well enough so far however there seems to be an issue with drawing. The ListView has a background, the rows are transparent. When I select a row and the slide to the next list occurs the rows turn (I think) transparent, then the ListView background is painted once the animation

add background image to android ListView using Picasso

那年仲夏 提交于 2019-12-21 05:06:12
问题 I need to add a background image to a ListView. Normally I would call listview.setBackground(myImage) . But the image is coming from server and so I need to use Picasso to load the image into the background of my ListView. How do I do that? 回答1: Option One Define an anonymous subclass of com.squareup.picasso.Target Picasso.with(yourContext) .load(yourImageUri) .into(new Target() { @Override @TargetApi(16) public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { int sdk = android

onCheckedChanged fired multiple times, Listview with checkbox

前提是你 提交于 2019-12-21 04:14:41
问题 I have a ListView with checkbox: Oncheckedchanged(..) is called when user check/uncheck item on listview OncheckedChanged(..) called again when user click the listitem via onItemClick(.....) Is this a known issue? how to differentiate the events. public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder = null; if (convertView == null) { LayoutInflater inflator = context.getLayoutInflater(); convertView = inflator.inflate(R.layout.row, null); viewHolder =

How to maintain ListView position when using the new Loader APIs?

时间秒杀一切 提交于 2019-12-21 03:54:28
问题 In Honeycomb the Loader APIs were introduced as the proper way to provide data to an application by doing the heavy lifting on a background thread. In my application I'm working to replace all my Cursor s with Loader s that return Cursor s. Since Cursor.requery() is depreciated now, it is recommended to just call restartLoader and allow the work to again be done on a background thread and then changeCursor when it returns in onLoadFinished . All of this works wonderfully except that the