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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:15:35+00:00 2026-05-28T02:15:35+00:00

I have have not found a practical example that specifically pertains to saving the

  • 0

I have have not found a practical example that specifically pertains to saving the file path of a image that you just took with the camera app to a SQLite database in your application.

I have seen code to save an image from a HTML source… no good! My issue is that I have the URI but honestly, I can’t figure out with the available data (dev guide, Stack Overflow questions) how to insert that file path to my database column.

Here is my code where I try setting an edit text field so that the path is savable to the database. I tried this in the emulator:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == TAKE_PHOTO_CODE && resultCode == RESULT_OK) {
        Bitmap x = (Bitmap) data.getExtras().get("data");
        File storagePath = new File(Environment.getExternalStorageDirectory() +
                                    "/DCIM/GPAA/"); 
        storagePath.mkdirs();
        File myImage = new File(storagePath,
                                System.currentTimeMillis() + ".jpg");
        try { 
            FileOutputStream out = new FileOutputStream(myImage); 
            x.compress(Bitmap.CompressFormat.JPEG, 80, out); 
            Uri outputFileUri = Uri.fromFile(myImage);
            mnotesText = (EditText)findViewById(R.id.notes);
            mnotesText.setText (outputFileUri.toString());
            ((ImageView)findViewById(R.id.photoResultView)).setImageBitmap(x);
            out.close();

            Toast.makeText(Review.this, 
                           "Image saved: " + outputFileUri.toString(), 
                           Toast.LENGTH_LONG).show();
        } catch (FileNotFoundException e) {
        } catch (IOException e){
        }
    }
}

With this code the toast verifies that the string is available and correct. However the entry to the mnotesText.setText (outputFileUri.toString()); works in the emulator. But strangely enough will not work on the phone.

  • 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-28T02:15:36+00:00Added an answer on May 28, 2026 at 2:15 am

    Mr. Ed answered provided this answer in his own question, I cleaned it up below:

    I’m sure this is not the preferred way to do this but it works:

    1. In your layout.xml define a edit text field and hide the text by changing the color of the text to the background. Or not if you want to see the text.

    2. Add the appropriate field in your database manager.

    3. In your activity, insert the text to the text field.

      String path = outputFileUri.toString();
      mpic.setText (path);
      

    When it is saved the path is saved to the database. Use BitmapFactory to decode the image path like this:

    // String username created from edit text field to a string
    String username = mpic.getText().toString(); 
    // Bitmap will decode the string to a image (bitmap)
    Bitmap myBitmap = BitmapFactory.decodeFile(username);
    // Image view used to set the bitmap
    ImageView myImage = (ImageView) findViewById(R.id.photoResultView);
    // Setting the image to the image view
    myImage.setImageBitmap(myBitmap);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a hum-dinger of a problem that I have not found an answer
I've investigated several C# DLL's and have not found any that work especially well.
I have scanned 'the Google' and have not found the definitive answer on whether
I have searched far and wide on the Internet but have not found anything
I know this issue has been touched on here but I have not found
I've searched the iPhone documentation and on google but have not found any information
should be simple right? but have not found any anwsers :
I've been trying to find a way to do this but, have not found
I've tried various editors, both desktop applications and web-based RTEs, but have not found
I have searched around a bit, and have not really found a professional type

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.