android-cursoradapter

ListView: filtering via Filterable vs. restarting CursorLoader with new URI

天涯浪子 提交于 2019-12-07 14:05:03
问题 The ListView implements methods for filtering the content. Can you elaborate on when it should be used? As I understand it, that kind of filtering is suitable for the array based adapter -- all data already is in memory. This way, the filter just helps to skip the data that should not be displayed. However, if the ListView is used with a cursor adapter (SQLite database) for displayig a lot of items, the data may not be in memory. On the other hand, the filter value can be embed in the SQL

CursorAdapter slow/jerky scroll

我怕爱的太早我们不能终老 提交于 2019-12-07 13:31:59
问题 I've got a ListActivity that's using a CursorAdapter to draw a dataset in a table format. I originally used a TableLayout (and drew the entire table) but I was concerned that this was using too much memory (and drawing the page was slow) so I'm now investigating using a CursorAdapter. The XML layout for the body of the activity looks like this (note the use of a HorizontalScrollView, which may be a cause): <?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas

Why is CursorAdapter different from BaseAdapter?

天涯浪子 提交于 2019-12-07 11:12:37
问题 I would like to ask why CursorAdapter splits the process of creating a view and populating it with data into newView() and bindView() while BaseAdapter only does this with getView() ? 回答1: From Source code of CursorAdapter.java, CursorAdapter extends BaseAdapter . And you can see getView() function implementation: public View getView(int position, View convertView, ViewGroup parent) { if (!mDataValid) { throw new IllegalStateException("this should only be called when the cursor is valid"); }

nullPointerException with extended SimpleCursorAdapter

China☆狼群 提交于 2019-12-06 13:41:46
问题 I'm learning about custom providers and loaders. As a simple example I'm trying to implement a GridView that shows the pictures stored in the external SD card. Although I've read a lot (documentation, threads on SO, Google groups, forums...) I'm not able to get my code working. I know that several issues may be present on this example but I want to go step by step. The first error stopping the code is a NullPointerException , so my question is how to fix it. This is a minimal version of my

CursorAdapter breaks CHOICE_MODE_MULTIPLE option

拟墨画扇 提交于 2019-12-06 09:21:13
问题 I have a ListFragment , where I add a CursorAdapter to my ListView , and I want to be able to click several rows, to use contextual action bar. I use SherlockActionbar, and it works fine, when I use a simple ArrayAdapter . But when I switch to CursorAdapter , it breaks. I cannot select multiple rows, only one. Any idea why it might happen? In onActivityCreated I set up the list: @Override public void onActivityCreated(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

ListView Requires 2 setSelection's to Scroll to Item

强颜欢笑 提交于 2019-12-06 04:28:47
Peculiar problem I'm having with a cursoradapter in a listfragment. In my onLoadFinished I select the previously selected item in order to scroll the listview to the previous position (and then highlight that item). This works splendidly, except for the scrolling part. If I just use one post and delay it (even say 5 seconds), the item gets selected but the list will not scroll (the selected item may out of view at this time) With or without delay same behavior with just one post. I have to post setSelection AGAIN to get the listview to scroll so the selected item is in view. It doesn't matter

My Custom CursorAdapter doesn't update my ListView

做~自己de王妃 提交于 2019-12-06 04:12:28
I'm having troubles with my Custom CursorAdapter and my ListView , the fact is, I can save data in my sqlite Database in my custom ContentProvider but my ListView is not populated. I know DB Operations are heavy long operations, therefore I do it in another thread and furthermore CursorLoader is a subclass of AsyncTaskLoader , so it should be prepared for that. With SimpleCursorAdapter works fine but with this Custom CursorAdapter not. Can anyone tell me what is wrong and how could I solve it? Thanks in advance. My code is the following public class TextNoteAdapter extends CursorAdapter { /***

How to change background color of searched text in listview-cursoradapter while typing in searchview?

…衆ロ難τιáo~ 提交于 2019-12-06 01:57:23
I've seen tutorials about highlighting text in listview using Spannable string but there is none about searching text from database and highlighting in listview . I have a listview which gets data from database/cursor and shows with the help of cursoradapter . I've placed searchview in action bar to search text from database table. Now i want that when i type a character or word in searchview, every matched result from database table should highlight/change background color of textview in listview . I'm confuse about where to perform search operation(in activity or cursoradapter ) and how to

CursorAdapter slow/jerky scroll

落爺英雄遲暮 提交于 2019-12-06 00:51:23
I've got a ListActivity that's using a CursorAdapter to draw a dataset in a table format. I originally used a TableLayout (and drew the entire table) but I was concerned that this was using too much memory (and drawing the page was slow) so I'm now investigating using a CursorAdapter. The XML layout for the body of the activity looks like this (note the use of a HorizontalScrollView, which may be a cause): <?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android

Why is CursorAdapter different from BaseAdapter?

六眼飞鱼酱① 提交于 2019-12-05 12:07:55
I would like to ask why CursorAdapter splits the process of creating a view and populating it with data into newView() and bindView() while BaseAdapter only does this with getView() ? From Source code of CursorAdapter.java , CursorAdapter extends BaseAdapter . And you can see getView() function implementation: public View getView(int position, View convertView, ViewGroup parent) { if (!mDataValid) { throw new IllegalStateException("this should only be called when the cursor is valid"); } if (!mCursor.moveToPosition(position)) { throw new IllegalStateException("couldn't move cursor to position