Wednesday, June 1, 2011

Re: [android-developers] Result of two list adapters, merged in one View

Use MergeCursor:

http://developer.android.com/reference/android/database/MergeCursor.html

On Wed, Jun 1, 2011 at 5:23 PM, Arun N R <coolgeminiarun@gmail.com> wrote:
> Hi,
>    I have some code which executes two queries against a database and
> returns two cursor objects. Is there any way that I can combine these
> two cursors are displayed one after another in one view.
>
> Currently one of the cursor is (Picked from samples)
>
>        Cursor c = mDbHelper.fetchNumber(searchNum);
>        startManagingCursor(c);
>
>        String[] from = new String[] { NumberDbAdapter.KEY_TITLE };
>        int[] to = new int[] { R.id.text1 };
>
>        // Now create an array adapter and set it to display using our
> row
>        SimpleCursorAdapter notes = new SimpleCursorAdapter(this,
> R.layout.notes_row, c, from, to);
>        setListAdapter(notes);
>
> If I have one more cursor of similar type, how do we display the
> output of these two in one view?
>
> Please help.
> Thanks in Adv
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in Oslo: http://bit.ly/fjBo24

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment