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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:53:44+00:00 2026-05-18T21:53:44+00:00

i am developing one app i am using upload image in sdcard getting from

  • 0

i am developing one app i am using upload image in sdcard getting from uri of image ,
this convert in to byte array how can implemented i am new developer in android i am saving this image in byte array in database backend please forward some solution ….

 startActivityForResult(new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), 1);
            }
  public void onActivityResult(int requestCode,int resultCode,Intent data)  
 {
 super.onActivityResult(requestCode, resultCode, data);
 if (resultCode == Activity.RESULT_OK) 
 {
 Uri selectedImage = data.getData();
 Cursor cur = PhotoImage.this.managedQuery(selectedImage, null, null, null, null);
 if(cur.moveToFirst())
 {
 long Length = cur.getLong(cur.getColumnIndex(ImageColumns.SIZE));
 try{
 String Image=Base64.encodeBytes(selectedImage.getPath().getBytes());
 Log.v("check",Image);
 byte[] bytedata = new byte[(int) Length];
 FileOutputStream fos=new FileOutputStream(Img);
 fos.write(bytedata[0]);
 fos.close();
   }
 catch (Throwable th)
 {}

output is:

12-30 13:00:24.619: VERBOSE/check(773): L2V4dGVybmFsL2ltYWdlcy9tZWRpYS8y

this is the display output i think not converted in byte array please some solution ..

  • 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-18T21:53:44+00:00Added an answer on May 18, 2026 at 9:53 pm

    This code will convert image file into bytes:

    FileInputStream fin = c.openFileInput(path of file);
    byte[] imageBytes = new byte[fin.available()];
    fin.read(imageBytes);
    

    put this in try...catch()

    Try this and let me know if you are asking the same or some thing else.

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

Sidebar

Related Questions

When developing an app that will listen on a TCP/IP port, how should one
I'm developing a Mac App in Java that logs into any one of our
What are profound advantages that one get when using COM for developing components over
I am developing a web app using silverlight. I read that Microsoft offers 10
I'm developing a web app using Django, and I'll need to add search functionality
I'm developing a WPF app using MVVM. Most of my views have only xaml
I am developing a web app using ASP.NET 2.0 (C#), where on home page
I am developing a Python web app using sqlalchemy to communicate with mysql database.
We're developing an app (using Grails Spring Security (formerly Acegi)) in which we'll have
I am developing an app using Grails and GWT for a client side. I

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.