simplecursoradapter

Android: SimpleCursorAdapter usage

心已入冬 提交于 2019-12-22 00:49:51
问题 I have ONE annoying problem with SimpleCursorAdapter. My programm has list view and ListActivity. Each row has it's own layout: <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="horizontal" android:weightSum="1.0"> <TableRow> <TextView android:id="@+id/task_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="24sp" android:text="Time">

Using pagination with CursorLoader and MergeCursor closes old cursors

怎甘沉沦 提交于 2019-12-22 00:38:43
问题 As the title says, when trying to paginate a ListView backed by a SimpleCursorAdapter and a CursorLoader , old cursors are getting closed, thus the below exception is being thrown. The first 2 pages load just fine (the first isn't using the MergeCursor and the second page is the first one to use the MergeCursor ). I don't call any close() on any cursor whatsoever. What is interesting is that while debugging, I cannot see the closed flags on any cursor being set as true, for what it's worth.

ERROR/AndroidRuntime(335): Caused by: java.lang.NullPointerException

扶醉桌前 提交于 2019-12-22 00:02:45
问题 Hi i'm new bee to android. while executing my application I'm getting nullpoint exception error, dont know why it is happening. please any one help me to get rid from this issue. thanks in advance. This is my logcat: 09-14 12:30:14.027: INFO/System.out(365): Constructor StudentList Adapter... 09-14 12:30:14.027: DEBUG/AndroidRuntime(365): Shutting down VM 09-14 12:30:14.027: WARN/dalvikvm(365): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 09-14 12:30:14.047: ERROR

Using notifyDataSetChanged on SimpleCursorAdapter does not work

穿精又带淫゛_ 提交于 2019-12-21 22:36:57
问题 In my code, right now, in order to properly refresh a listview I have to re-fetch my database information and recreate the SimpleCursorAdapter . For example, I have a button inside a listview. When this button is clicked, it removes the entry from the database for the listview item. So all I want to happen is have the item removed from the listview, without having to recreate the adapter. I've tried changing my global from SimpleCursorAdapter to BaseAdapater (because it extends

android ListView : scrollTo doesn't work

浪子不回头ぞ 提交于 2019-12-21 13:11:34
问题 I have a view that contains a ListView which is binded to a cursor adapter. When The cursor content change I want to keep the ListView at the top then in my custom cursor adapter I added : @Override protected void onContentChanged() { // ... myListView.scrollTo(0, 0); } but this doesn't work. Then I read somewhere to queue this action like this : myListView.post(new Runnable() { public void run() { myListView.scrollTo(0, 0); } }); but this doesn't work either. How can I keep the ListView at

When to close Cursor used in SimpleCursorAdapter

倖福魔咒の 提交于 2019-12-21 07:42:14
问题 I'm using a SimpleCursorAdapter to display results in a ListView but since I've got to query my database lots of times during a search (using the SearchView widget) it worries me that the cursor might be left opened. This is how I query my database and show the results in a ListView: class SearchCustomers extends AsyncTask<String,Void,Cursor>{ @Override protected Cursor doInBackground(String... params) { //get the query String query=params[0].toLowerCase(Locale.getDefault()); Cursor cursor

When to close Cursor used in SimpleCursorAdapter

风流意气都作罢 提交于 2019-12-21 07:41:15
问题 I'm using a SimpleCursorAdapter to display results in a ListView but since I've got to query my database lots of times during a search (using the SearchView widget) it worries me that the cursor might be left opened. This is how I query my database and show the results in a ListView: class SearchCustomers extends AsyncTask<String,Void,Cursor>{ @Override protected Cursor doInBackground(String... params) { //get the query String query=params[0].toLowerCase(Locale.getDefault()); Cursor cursor

Fetch Genre name list which have songs in it

谁说我不能喝 提交于 2019-12-21 05:04:52
问题 I am fetching Genre list from media content Provider of android using CursorLoder class. below is my cursor query to fetch the list of Genre. public Loader<Cursor> onCreateLoader(int id, Bundle args) { // currently filtering. Uri baseUri; baseUri = MediaStore.Audio.Genres.EXTERNAL_CONTENT_URI; String[] STAR = { "*" }; return new CursorLoader(getActivity(), baseUri, STAR, null, null, null ); } Now, i got all the genre list from the media content provider but the problem with the data i got. I

How to set Spinner Default by its Value instead of Position?

血红的双手。 提交于 2019-12-20 08:33:34
问题 I have 1-50 records in the database. I am fetching those data using cursor and set those values to Spinner using Simple Cursor Adapter. Now what i need is i want to set one value say 39th value as default. But not by its position i want to set by its value. I know how to set the spinner default by its position spinner.setSelection(39) will set the spinner to that value. But i didn't have any idea about setting the spinner default by its value(text) in the database. I know the values in the

simplecursoradapter textview giving nullpointerexception

陌路散爱 提交于 2019-12-20 07:26:16
问题 I have two xml files one is having the listview and another is having the layout of the listview vth some texviews, I want to change the color of the textview in the second xml file. This is what i have done so far. main1.xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingTop="4px"> <ListView droid:id="@android