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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:24:34+00:00 2026-06-04T14:24:34+00:00

Can we create an Bitmap object from the SD card image file path ?

  • 0

Can we create an Bitmap object from the SD card image file path ?

I have written a sample method to create it. Is it right approach?

public Bitmap createBitmap(String filepath){    
    try {
        // filepath e.g. "file:///SDCard/test.jpg"
        FileConnection fc = (FileConnection)Connector.open(filepath);
        byte[] responseData = new byte[10000];
        InputStream inputStream =fc.openDataInputStream();
        int length = 0;
        StringBuffer rawResponse = new StringBuffer();
        while (-1 != (length = inputStream.read(responseData))) {
            rawResponse.append(new String(responseData, 0, length));
        }

        byte[] dataArray = rawResponse.toString().getBytes();
        Bitmap bitmap = Bitmap.createBitmapFromBytes(dataArray, 0, dataArray.length, 1);
        // EncodedImage.createEncodedImage(dataArray, 0, dataArray.length);

        return bitmap;
    } catch (IOException e) {
        return null;
        // TODO Auto-generated catch block
        // e.printStackTrace();
    }
}
  • 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-04T14:24:35+00:00Added an answer on June 4, 2026 at 2:24 pm

    public final class MyScreen extends MainScreen {

    Bitmap bit, bit1;
    
    BitmapField bitf[] = new BitmapField[12];
    
    FileConnection fc;
    
    FlowFieldManager grid;
    
    String[] imgpath = { "bharat.png", "fighter1.jpg", "fighter2.jpg",
            "fighter3.jpg", "fighter4.jpg", "fighter5.jpg", "fighter7.jpg",
            "fighter8.jpg", "fighter9.jpg", "fighter10.jpg", "fighter11.jpg",
            "fighter6.jpg" };
    String compath = "file:///SDCard/";`enter code here`
    
    public MyScreen() {
        grid = new FlowFieldManager();
        try {
    
            setTitle("Bharat Title");
    
            for (int i = 0; i < imgpath.length; i++) {
    
                fc = (FileConnection) Connector.open(compath + imgpath[i]);
                DataInputStream in = fc.openDataInputStream();
                int size = (int) fc.fileSize();
                byte[] bb = new byte[size];
                bb = IOUtilities.streamToBytes(in);
                bit = bit.createBitmapFromBytes(bb, 0, bb.length, 1);
                bit1 = new Bitmap(120, 120);
                bit.scaleInto(bit1, Bitmap.FILTER_BOX);
                bitf[i] = new BitmapField(bit1, FOCUSABLE);
                grid.add(bitf[i]);
                fc.close();
    
            }
        }
    
        catch (Exception ex) 
        {
            ex.getMessage();
        }
        finally {
            try {
                fc.close();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    
        add(grid);
    }
    

    }

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

Sidebar

Related Questions

If I have a .Net Bitmap , I can create from it a GDI
Frequently we get image from server as byte stream, then we create Bitmap and
I was loading a Bitmap Image from a File. When I tried to save
One can create an anonymous object that is initialized through constructor parameters, such as
How can I convert a WPF WriteableBitmap object to a System.Drawing.Image? My WPF client
I'm loading the image from the url by using LoadImage method and storing it
How can I create An object encoded in G3 fax as explained in recommendation
I'm reading from an image file via OpenImageFileDialog , which accepts both .ico and
I have an application where I am generating many Bitmap objects. Once I create
I have an object that stores the compressed ByteArray version of an image (jpg

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.