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

  • Home
  • SEARCH
  • 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 8836237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:26:52+00:00 2026-06-14T09:26:52+00:00

Hello all having some trouble when I attempt to add an image to a

  • 0

Hello all having some trouble when I attempt to add an image to a viewflipper page, I am pulling the bitmaps from the db4o database (not sure if it is the encoding or something it uses that is messing me up).

private void setImageView() {
    page = (ViewFlipper) findViewById(R.id.viewFlipper1);

    int temp = DigPlayDB.getInstance(getBaseContext()).getPlaysDBSize();

    for(int j = 0; j < temp; ++j){
        test.add(DigPlayDB.getInstance(getBaseContext()).getPlayByInt(j).getImage());
        test1.add(DigPlayDB.getInstance(getBaseContext()).getPlayByInt(j).getPlayName());
    }

    for(int i=0;i<temp; i++)
    {
        //  This will create dynamic image view and add them to ViewFlipper
        setFlipperImage(test.get(i));
    }

And then for the setting of the image and adding the view to the page

private void setFlipperImage(Bitmap image){
    ImageView _image = new ImageView(getApplicationContext());
    //_image.setBackgroundDrawable(new BitmapDrawable(getResources(), image));
    _image.setImageBitmap(image);
    page.addView(_image);
    Log.d("db", "" + image);

} 

It works right after I add an image to the database but just that image, older images as well as when I restart the application do not load up even though it says they do from a debugging log I set. I am thinking that the last one shows up since it could still be in a cache somewhere, but the older ones that are stored in the database and not in a cache are not encoded correctly or something. Any help would be awesome. Thanks!

Edit: I should mention that “test” is an arraylist of Bitmaps.

  • 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-14T09:26:54+00:00Added an answer on June 14, 2026 at 9:26 am

    Ok, you said in the comment that you store the object as a Bitmap instance. I guess thats a Android or library class.

    Don’t do that. Only store instances of your own classes. Storing instances of your classes, java.util.collections, arrays and primitives are okay. Everything else is bound to issues: db4o will eagerly try to store any object. This is a issue for library instances. You don’t have control of what they do, how they work internally and if they still work after loading.

    I think that’s whats happening here. As long as the application is running, db4o returns the cached instance of the object, which is fine. After restarting the application, db4o loads the Bitmap object. However the bitmap object isn’t intended to be stored with db4o, so it stumbles over wrongly stored internal state.

    So, store your picture in a byte-array. Or just as plain file on the SD-card.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello all having some trouble accessing elements from a returned JSON from Twitter. I'm
I am having some trouble as follows: When i add a new user, it
Hello all I am having a issue with showing a xib file from the
Problem Hello all! I have this code which takes my jpg image loops through
I've been tasked with maintaing some legacy fortran code, and I'm having trouble getting
hello i get some help here yesterday for a problem i was having tablesorter.
I'm having trouble getting a simple Hello World app to work using Flask, MongoDB,
hello friends i am working on a like module .and having some difficulties running
I'm having trouble some special characters in Qt, the 2 being the quote and
Hello I seem to be having some problem involving counting in Django. I have

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.