android-cursoradapter

RecyclerView not updating after calling changeCursor

我怕爱的太早我们不能终老 提交于 2020-08-10 13:12:10
问题 Background: I have an orders table in my database whose data I show in RecyclerView . I do it by using a CursorAdapter in RecyclerView.Adapter . All of this is done in parent activity. Besides this I have a child activity which is responsible for adding new orders to orders table and then coming back to parent activity to show all the orders in RecyclerView including the newly ones just created. New orders are added by starting a child activity in addOrder() . Problem: When I come back from

simple cursor adapter requires minimum api 11 issue

不羁的心 提交于 2020-02-01 05:18:07
问题 I am working on a app , in which i require to populate list view from the database. I am getting compatibility issue in following code dataAdapter = new SimpleCursorAdapter( this, R.layout.eventlisting, cursor, columns, to, 0); It requires min api level 11 , mine is 8. Is there any alternative for this to make this code work on api 8 as well. Can i use support library? 回答1: Try the SimpleCursorAdapter from the support class. It is used like the API 11+ version and it is already backwards

How to get Android Contact thumbnail

别来无恙 提交于 2020-01-29 06:38:04
问题 I have a listview adapter and I'm trying the following in the newView method: @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { final LayoutInflater inflater = LayoutInflater.from(context); View v = inflater.inflate(layout, parent, false); long contactId = Long.valueOf(cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID))); String contactName = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); boolean hasPhone =

How to override the getItemId(int pos) method from CursorAdapter?

社会主义新天地 提交于 2020-01-22 22:57:35
问题 I am getting this question due to another answer on here, but didn't explain how to do what I am asking How to get the id of the row in onItemClick(ListView) when using a custom Adapter? The answer which was accepted in that question is what I need since I am also making my own custom adapter (CursorAdapter), hence I will have the same problem. The problem is I have no idea how to accomplish that. I am looking at the Doc, and am not sure how to access the _id column from a cursor. Since the

How to override the getItemId(int pos) method from CursorAdapter?

橙三吉。 提交于 2020-01-22 22:56:30
问题 I am getting this question due to another answer on here, but didn't explain how to do what I am asking How to get the id of the row in onItemClick(ListView) when using a custom Adapter? The answer which was accepted in that question is what I need since I am also making my own custom adapter (CursorAdapter), hence I will have the same problem. The problem is I have no idea how to accomplish that. I am looking at the Doc, and am not sure how to access the _id column from a cursor. Since the

RecyclerView not correctly displaying Heterogenous Layouts

我是研究僧i 提交于 2020-01-16 19:35:49
问题 I am developing a weather app in which i wanted to use two Views inside RecyclerView which is having CursorAdapter as its member. I want to use one View to display todays weather and other view to display other days weathers. My RecyclerView is working perfectly and i even displaying the two layouts but not correctly i.e layout i want to use for today's weather is used by tomorrow weather and second last day in the list Following is the code for my RecyclerView Adapter :- public class

mcheckBox.setOnCheckedChangeListener within CursorAdapter

大兔子大兔子 提交于 2020-01-15 05:10:08
问题 I have a ListView that is populated using a custom CursorAdapter. Within BindView, I have the following code: CheckBox mCheckBox = (CheckBox) view.findViewById(R.id.list_done); mCheckBox.setChecked(isDone); mCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { AW.getDB().updateTask(c.getInt(c.getColumnIndex(ToDoDBAdapter.KEY_ID)), isChecked); TD.displayTasks(); } }); However, when one of the checkboxes

get a position in bindView using CursorAdapter

久未见 提交于 2020-01-15 04:59:08
问题 i am create a listview which has two TextView and one custom view as a selection indicator , to load data i am using CursorAdapter and overriding bindView and newView . but the issue is in preserving the selection index. when i am tapping a list item , i am saving the position of it into view as follows View v1=(View)view.findViewById(R.id.viewColor); v1.setTag(position) but inside a bindView i not getting a position where i can perform a match by fetching position from view's tag as follows

Android ContentProvider calls bursts of setNotificationUri() to CursorAdapter when many rows are inserted with a batch operation

人走茶凉 提交于 2020-01-12 04:44:32
问题 I have a custom ContentProvider which manages the access to a SQLite database. To load the content of a database table in a ListFragment , I use the LoaderManager with a CursorLoader and a CursorAdapter : public class MyListFragment extends ListFragment implements LoaderCallbacks<Cursor> { // ... CursorAdapter mAdapter; @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mAdapter = new CursorAdapter(getActivity(), null, 0);

Android CursorAdapter not refreshing on first load

喜夏-厌秋 提交于 2020-01-06 08:29:11
问题 EDIT I didn't add my XML I am writing a dialog for tagging selections. The first view is applying tags they have in their db. The next screen is a dialog for adding new tags to their db. I am supplying suggestions for them to use for their tags. I want to filter the list when they begin typing in their tag. I am using two custom CursorAdapters for each screen but they share the same ListView. I am also using a CursorLoader to run my queries in the background both are extended from the support