Hi,
As Romain said it is a bug which will be fixed in the new release.
In the meanwhile as you are facing this problem for your challenge
application, please mention this in your README file along with the
workaround and the judges will accept it. It is an issue with the API,which
will not affect how your application is graded. You can also add the link to
the discussion about this issue in the groups/android issue tracker.
Thanks,
Megha
On Thu, Mar 27, 2008 at 10:10 PM, Rainer <[EMAIL PROTECTED]> wrote:
>
> This is the code in the Activity I am using. As you can see, all I am
> doing is configuring the autocompletebox just as its intended to be
> done. All the rest is done by android classes.
>
> @Override
> protected void onCreate(Bundle icicle) {
> super.onCreate(icicle);
> m_adapter = new SimpleCursorAdapter(this,
> android.R.layout.simple_list_item_1,
> m_cursor,
> PROJECTION,
> new int[] { android.R.id.text1 },
> CONTENT_URI,
> DEFAULT_SORT_ORDER);
> m_adapter.setFilterQueryProvider(new
> SimpleCursorAdapater.FilterQueryProvider() {
>
> @Override
> protected Cursor runQuery(CharSequence
> constraint) {
> StringBuilder buffer = null;
> String[] args = null;
> if (constraint != null) {
> buffer = new StringBuilder();
> buffer.append("UPPER(");
> buffer.append(m_projection[0]);
> buffer.append(") GLOB ?");
> String filter =
> constraint.toString().toUpperCase() + "*";
> if (m_filterMode == FILTERMODE_CONTAINS)
> {
> filter = "*" + filter;
> }
> args = new String[] { filter };
> }
>
> return m_contentResolver.query(CONTENT_URI,
> PROJECTION,
> buffer == null ? null :
> buffer.toString(), args,
> m_sortOrder);
> }
> m_box = (AutoCompleteTextView)
> findViewById(R.id.autocomplete);
> m_box.setAdapter(m_adapter);
>
>
> ...
> }
>
> I got some feedback from Romain Guy who stated that this is a bug (my
> guess is that it is in CursorAdapter) and was already fixed but
> obviously as there is no new SDK version out, I still cant really test
> my application properly as after a couple of filter queries I would
> get exceptions.
>
> cheers
> - Rainer
> On Mar 28, 12:58 am, "Megha Joshi" <[EMAIL PROTECTED]> wrote:
> > Hi Rainer,
> >
> > Could you provide your relevant code snippet?
> > I am guessing you could not invalidate the cursor before using as I said
> > earlier.
> >
> > Thanks,
> > Megha
> >
> > On Thu, Mar 27, 2008 at 12:01 PM, Rainer <[EMAIL PROTECTED]> wrote:
> >
> > > runQuery is called by the framework (I.e. CursorAdapter). I am simply
> > > using SimpleCursorAdapter with a FilterQueryProvider.
> >
> > > cheers
> > > - Rainer
> >
> > > On Mar 27, 7:12 pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote:
> > > > Hi,
> >
> > > > You should not be calling the runQuery() method explicitly...are
> you
> > > > overriding the runQuery() method to form your own CursorAdapter?
> > > > I am not sure how your code looks like, but before using the
> cursor,
> > > you
> > > > could use:
> >
> > > > if (cursor !=null)
> > > > cursor.invalidate();
> >
> > > > Thanks,
> > > > Megha
> >
> > > > On Wed, Mar 26, 2008 at 9:23 PM, Rainer <[EMAIL PROTECTED]> wrote:
> >
> > > > > Hey
> > > > > I have a form with an AutoCompleteTextView which is backed by a
> > > > > SimpleCursorAdapter. My problem is that it seems that nobody
> closes
> > > > > the Cursors returned by runQuery(). I dont think that I as a user
> of
> > > > > SimpleCursorAdapter am responsible for closing them as there does
> not
> > > > > seem to be an obvious place to do that. Also the decompliation
> report
> > > > > (ups, should I say that?) of CursorAdapter seems to indicate that
> > > > > these cursors are simply lost and never closed. The effect is that
> > > > > after using the query feature a couple of times and dismissing the
> > > > > Form (I guess this is then when the garbage collector starts
> cleaning
> > > > > up) I get an IllegalStateException warning me that the cursor has
> not
> > > > > been closed.
> >
> > > > > The documentation of SimpleCursorAdapter.runQuery does not mention
> > > > > that the cursor must be remembered and closed. Also even if I
> tried
> > > > > that, I dont find an obvious place (event) at which point it would
> be
> > > > > safe to close the cursors (I would need to subclass
> > > > > SimpleCursorAdapter or provide a FilterQueryProvider which would
> then
> > > > > remember all Cursors that have been handed out and only then clean
> > > > > them up at an appropriate time.
> >
> > > > > I honestly think this is a bug.
> >
> > > > > Any suggestions? I am so close to submitting my dev challenge
> project.
> > > > > Argh.
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---