android-listview

How to update progressbar in a ListView item

好久不见. 提交于 2019-12-03 04:25:23
问题 I have a ListView attached to an ArrayAdapter . When the user clicks a download button for an item in the ListView a download starts using the DownloadManager . What I want to do is to track the download progress with a progress bar (placed in the item layout). How can this be achieved? The way Pocket Cast does it is exacly what I'm after: Pocket Cast exampel http://www.mrcrab.net/images/thumb_big/9982-Pocket_Casts_Apk_v4.3.2_Android-0.jpg Note: I know how to work with the DownloadManager ,

How to get checked radio button in list view?

混江龙づ霸主 提交于 2019-12-03 04:07:25
I want to get checked radio button from list view from list item like below image. AttendanceView.class package com.cfms.ApplicationLayer; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.RadioGroup; import android.widget.TextView; import android.widget.Toast; import com.cfms.cfms_project.R; public class

Custom SimpleCursorAdapter, database query and NullPointerException

梦想的初衷 提交于 2019-12-03 03:55:40
I'm trying to make ListView populated from database, and spice each row with fancy delete button. So I made list Activity and custom SimpleCursorAdapter. This is main ListView activity: public class EditEntries extends ListActivity { Cursor cursor; DBAdapter db = new DBAdapter(this); private static String[] FROM = { _ID, SCORE_COLUMN, "date(time, 'localtime')", }; private static int[] TO = { R.id.rowid, R.id.title, R.id.time, }; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.entries_list); try { cursor = getEvents(); showEvents

How can I implement a Material Design Expand/Collapse List on Android?

左心房为你撑大大i 提交于 2019-12-03 03:45:41
问题 I am looking to implement a material list of this style. How can I do this on Android? What classes should I look at? Are there any existing libraries that could make implementing this easy? 回答1: Yes, you can easily implement it with the library SectionedRecyclerViewAdapter. There is a full working example here. Basically you create a section class: class MySection extends StatelessSection { String title; List<String> list; boolean expanded = true; // true if you want it to be displayed

Android: Make view on top of listview scroll together with the listview

∥☆過路亽.° 提交于 2019-12-03 03:24:42
I have a listview which is obviously scrollable. The listview contains some form questions. Once the user submitts the form we put a stamp-like looking custom view on top of the listview (and prevent user from answering questions, but it doesn't matter here). The stamp should appear at the top of the listview (as in top of the screen) and be scrollable at the same speed as the listview, i.e. it should disappear when the listview items which were initially underneath it disappear at the top of the screen when scrolled. Any idea how to achieve this? Maria I found a solution. Not sure if it is

Deleting items from a ListView using a custom BaseAdapter

只谈情不闲聊 提交于 2019-12-03 03:08:24
I am using a customised BaseAdapter to display items on a ListView. The items are just strings held in an ArrayList. The list items have a delete button on them (big red X), and I'd like to remove the item from the ArrayList, and notify the ListView to update itself. However, every implementation I've tried gets mysterious position numbers given to it, so for example clicking item 2's delete button will delete item 5's. It seems to be almost entirely random. One thing to note is that elements may be repeated, but must be kept in the same order. For example, I can have "Irish" twice, as

Can I create Fragment ListActivity with compatibility package v4?

徘徊边缘 提交于 2019-12-03 02:41:54
I've been trying to complete tutorial "Working with fragments" which was designed for android 3.0+ To acomplish that I'm using compatibility package v4 (since my API is 7). However I'm stuck on the lists. I couldn't find straight answer. I'm getting a ClassNotFoundException. I inherited fragment class from FragmentActivity but what about my ListActivity? There is no such thing as FragmentListActivity and I think it keeps crashing at this. Can I create Fragment ListActivity with compatibility package v4? Or it's not possible at all? Nope, doesn't exist. Stupid support library. The solution is

Android Endless list memory management

纵然是瞬间 提交于 2019-12-03 02:36:47
I'm implementing an endless listview by loading more items to the arraylist in the onScrollStateChanged(...) method. If I'm implementing this scheme for fetching more than 1 million entries, I will have a million objects added to the arraylist, which is memory intensive. What schemes can I use for efficient memory management ? PS: The question is about the number of items that can be put into the adapter. Edit: More details: The source of the data is Internet. I have to fetch the data from the Internet and put it into the listview adapter. I think you should just keep the current entries and

How to handle the fast-scroller on Lollipop 5.1?

僤鯓⒐⒋嵵緔 提交于 2019-12-03 01:41:18
Background I've made a tiny library, which shows how to mimic the style of the stock contacts app of Android Lollipop, here . The problem It seems that on Android 5.1 , the fast scroller looks very different than the previous one, and it's too close to the right, so it's hard to use it. screenshot of Android 4.4 : Here's a screenshot on Android 5 : and on Android 5.1 : What I've found I've tried to go over all of the "what's new" section of Android 5.1, and also in some related classes docs, but I didn't find anything special, except for " setFastScrollStyle " . However, I couldn't find any

How to use fast scroll in android?

别来无恙 提交于 2019-12-03 01:38:09
问题 I have a list of events which are seperated by month and year (Jun 2010, Jul 2010 etc.) I want to enable fast scrolling because the list is really long. How do I enable fast scroll on ListViews in Android? 回答1: In the onCreate method of the ListActivity use setFastScrollEnabled: getListView().setFastScrollEnabled(true); 回答2: Use android:fastScrollEnabled in your xml: <ListView android:id="@+id/listview_files" ... android:fastScrollEnabled="true" > </ListView> 回答3: Try the following <?xml