Sunday, March 4, 2012

Re: [android-developers] Re: CursorAdapter? or OtherAdapter?

What Mark was asking is why are rows you do not need included in the
results pointed to by the cursor.

The cursor is loaded by a DB query. That is where you should apply
filtering, etc and the cursor should contain only what you need to
display at that moment. If your cursor has extra data, then adjust your
query to return only the rows you need. If you need several different
queries you can use more than one URI in your content provider so that
you map one URI to one query.

Choosing between an ArrayAdapter and a CursorAdapter really should be
driven by where the data are stored and how big of a list you have.
Without more knowlege of your app, it's hard to know which would be
better, but in general it is silly to unload a cursor into an array for
display when you can just use the cursor unless you have a compelling
reason not to.

On 3/3/2012 11:28 AM, Build Account wrote:
> Hello.
>
> Well,
> I don't understand what you point out 'these' part.
> But simply say it again,
> I'm looking for simplest way to not touch the current cursor further.
> And i can not use selectionArg since that available datas are kind
> of...random.(of course there is a condition to filter out row by row :
> ( ).
>
> Is there any way to mask(or filter) record as what I need under cursor
> adapter?
> if there is no way, I may shoud use ArrayAdapter by manually....
>
> What do you think?
>
>
>
> On Mar 3, 9:11 pm, Mark Murphy<mmur...@commonsware.com> wrote:
>> Why are these rows in your Cursor in the first place, if they are not
>> to be used?
>>
>>
>>
>>
>>
>> On Sat, Mar 3, 2012 at 1:59 AM, Build Account<newandroi...@gmail.com> wrote:
>>> Hello,
>>> If I have a cursor and need to display as a list through adapter,
>>> then which adapter is best under below condition?
>>> The cursor have datas(of course).
>>> But this cursor contains some of rows which should not be displayed.
>>> For example, totally 10 records, but index 1, 4, 5, 8 should not be
>>> displayed.
>>> (Means, not sequentially sorted. and also cannot sort it by sort
>>> order.).
>>> With above cursor data,
>>> how to filter out only available datas(which index 0, 2, 3, 6, 7, 9)
>>> in adapter?
>>> Any ideas or way to do???
>>> --
>>> 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/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>>
>> Android Training...At Your Office:http://commonsware.com/training

--
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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate