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 7891733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:41:34+00:00 2026-06-03T06:41:34+00:00

Ive been searching google for a way to convert a bundle into a string

  • 0

Ive been searching google for a way to convert a bundle into a string suitable to store in a database as a BLOB type. I have found lots of examples of serializing it to a file but no mention of how to put it into a string or byte aray. Can anyone give me an example of how this is done?

I am developing an app that will use plugin’s for custom UI components and want to call a configuration activity in the plugin passing a bundle of configuration options that were stored in a database. The activity would return the bundle with the updated options and then I need to save it back to the database.

If anyone can point me in the right direction I would be grateful.

  • 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-06-03T06:41:36+00:00Added an answer on June 3, 2026 at 6:41 am

    Your first step is to create a table to put this in. In this case something basic should do.

    CREATE TABLE bundles (
        _id INTEGER PRIMARY KEY AUTOINCREMENT, 
        name TEXT, 
        value BLOB);
    

    Then you will need a method for inserting the Bundle, like this:

    private void put(SQLiteDatabase db, String name, Bundle bundle) {
        ByteArrayOutputStream valueStream = new ByteArrayOutputStream();
        try {
            ContentValues rows = new ContentValues();
            rows.put("name", name);
            Parcel p = Parcel.obtain();
            bundle.writeToParcel(p, 0);
    
            valueStream.write(p.marshall());
            rows.put("value", valueStream.toByteArray());
    
            db.insert("bundles", null, rows);   
    
            valueStream.close();
        } catch (IOException e) {       
            Log.e("error writing object", e.toString());
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd been searching for a way to do cookie based authentication/sessions in Google App
I've been searching for a way to make a textarea type inside of itself.
Alright now, I have been searching everywhere for a way to accomplish this and
I’ve been searching Google and Stack Overflow like crazy for days and have yet
I've been searching for a way to overwrite a Google map's center latlng and
I've been searching and searching google for answers to my question but have been
I've been searching on Google for a resolution to this problem, but cannot find
I've been searching all up and down google trying to find this as well
Ive been searching for an answer for this and cant find one, although I
I've been searching the reason why the maximum length of String in a TMemo.Lines

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.