Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5982327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:04:17+00:00 2026-05-22T22:04:17+00:00

I manage to create a working CursorWrapper , but get stuck when I want

  • 0

I manage to create a working CursorWrapper, but get stuck when I want to use my ContentProvider across processes.

These posts even show how to implement the CrossProcessCursor interface, notably the hard and undocumented fillWindow() method:

  • What to do in custom ContentProvider's fillWindow() method?

  • Passing binary blob through a content provider

The problem is that I can think only of an implementation of fillWindow() that deals with a cursor with either all columns containing Blobs, or Strings, or …, but not a mix of those, as a real-world cursor is bound to have. The real issue here is a lack of a getType() function (exists only from v11 on), or a getRaw()/putRaw() that would just copy binary without complaining. How do you deal with this without incurring unwanted conversions in your returned cursor values?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:04:18+00:00Added an answer on May 22, 2026 at 10:04 pm

    I’ve implemented it as follows for now, but it does not feel like the right thing to do or robust:

    /**
     * Copy data from cursor to CursorWindow
     * @param position start position of data
     * @param window
     */
    public void fillWindow(int position, CursorWindow window) {
        if (position < 0 || position > getCount()) {
            return;
        }
        window.acquireReference();
        try {
            int oldpos = this.getPosition();
            this.moveToPosition(position - 1);
            window.clear();
            window.setStartPosition(position);
            int columnNum = getColumnCount();
            window.setNumColumns(columnNum);
            while (moveToNext() && window.allocRow()) {            
                for (int i = 0; i < columnNum; i++) {
    
                    //int type = getType(i);//only from v11 on
    
                    try {
                        String field7 = getString(i);
                        if (field7 != null) {
                            try {
                                    if (!window.putLong(new Long(field7), this.getPosition(), i)) {
                                        if (!window.putDouble(new Double(field7), this.getPosition(), i)) {
                                            if (!window.putString(field7, this.getPosition(), i)) {
                                                window.freeLastRow();
                                                break;
                                            }
                                        }
                                    }
                                } catch (NumberFormatException e) {
                                    try {
                                        if (!window.putDouble(new Double(field7), this.getPosition(), i)) {
                                            if (!window.putString(field7, this.getPosition(), i)) {
                                                window.freeLastRow();
                                                break;
                                            }
                                        }
                                    } catch (NumberFormatException e1) {
                                        if (!window.putString(field7, this.getPosition(), i)) {
                                            window.freeLastRow();
                                            break;
                                        }
                                    }
                                }
                        } else {
                            if (!window.putNull(this.getPosition(), i)) {
                                window.freeLastRow();
                                break;
                            }
                        }
                    } catch (SQLiteException e7) {
    
                        try {
                            byte[] field1 = getBlob(i);
                            if (field1 != null) {
                                if (!window.putBlob(field1, this.getPosition(), i)) {
                                    window.freeLastRow();
                                    break;
                                }
                            } else {
                                if (!window.putNull(this.getPosition(), i)) {
                                    window.freeLastRow();
                                    break;
                                }
                            }
                        } catch (SQLiteException e1) {
                            throw e1;
                        }
                    }
                }
            }
    
            this.moveToPosition(oldpos);
        } catch (IllegalStateException e){
            // simply ignore it
        } finally {
            window.releaseReference();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a Java frontend to add/manage content in a Lotus notes
hey guys, i manage to get this script working to pull data from my
help me to manage IIS (what i am trying to do is create virtual
I want to create a List of KeyValuePair s in a managed C++ project.
Hi am writing small app for posting twitts on twitter.com I manage to create
I have a project that I have recently started working on seriously but had
I followed this way. To create a workspace to manage your source-controlled files 1.
I'm getting frustrated at this. I want to create an iPhone application to show
So, I'm working on an app where users can upload and manage photos with
I managed to create a class using CodeDom and add a single method to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.