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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:19:54+00:00 2026-05-24T02:19:54+00:00

My application allows it’s user to start a camera intent to take pictures to

  • 0

My application allows it’s user to start a camera intent to take pictures to associate with people and evidence. I want to store the URI in a lookup table (ex: PersonMedia) and load thumbnails of the associated pictures into a gallery view; subsequently allowing the user to view the full image from the thumbnail. Every example I find demonstrates loading thumbnails from the SD Cards full contents but not from specific URI’s.

My second choice being to store the byte array in SQLLite, but I’m not a big fan of that. Any help would be greatly appreciated.

As a side note, in the past I couldn’t figure out how to vote on the correct answer. I finally got it! Yeah, I have my moments…lol.

  • 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-24T02:19:55+00:00Added an answer on May 24, 2026 at 2:19 am

    I solved this by loading images directly from the sd card by providing a dynamic directory path. Recalling the images by storing the URI’s in the database didn’t work the way I expected it to. Here is the code if anyone wants to do the same type thing.

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.personmedia);
    
        personId = ((Global) this.getApplication()).getCurrentPersonID();       
        mediaCount = ((Global) getApplication()).getDataHelper().getPersonMediaCount(personId) + 1;
        imageDirectory = Environment.getExternalStorageDirectory() + "/CaseManager/" + Long.toString(personId);
    
        PopulateGallery();
    }
    
    private void PopulateGallery() {
    
        try {
            if (LoadImageFiles() == true) {
                GridView imgGallery = (GridView) findViewById(R.id.gallery);
    
                imgGallery.setAdapter(new ImageAdapter(PersonMedia.this));
    
                // Set up a click listener
                imgGallery.setOnItemClickListener(new OnItemClickListener() {
    
                      public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    
                            String imgPath = paths.get(position);
    
                            Intent intent = new Intent(getApplicationContext(), ViewImage.class);
                            intent.putExtra("filename", imgPath);
                            startActivity(intent);
                      }
                });
            }
        } catch (Exception ex) {
            Log.e("PersonMedia.LoadPictures", ex.getMessage());
        }
    
    }
    

    private boolean LoadImageFiles() {

    try{
        mySDCardImages = new Vector<ImageView>();
    
        paths = new Hashtable<Integer, String>();
    
        fileCount = 0;
    
        sdDir = new File(imageDirectory);
        sdDir.mkdir();
    
        if (sdDir.listFiles() != null) 
        {
            File[] sdDirFiles = sdDir.listFiles();
    
            if (sdDirFiles.length > 0) 
            {               
                for (File singleFile : sdDirFiles) 
                {                   
                    Bitmap bmap = decodeFile(singleFile);
                    BitmapDrawable pic = new BitmapDrawable(bmap);
    
                    ImageView myImageView = new ImageView(PersonMedia.this);                    
                    myImageView.setImageDrawable(pic);
                    myImageView.setId(mediaCount);      
    
                    paths.put(fileCount, singleFile.getAbsolutePath());
    
                    mySDCardImages.add(myImageView);
    
                    mediaCount++;
                    fileCount ++;
                }
             }
           }
         }
           catch(Exception ex){ Log.e("LoadImageFiles", ex.getMessage()); }
    
         return (fileCount > 0);
    }
    
    //decodes image and scales it to reduce memory consumption
    private Bitmap decodeFile(File f){    
        try {        
                //Decode image size        
                BitmapFactory.Options o = new BitmapFactory.Options();       
                o.inJustDecodeBounds = true;        
                BitmapFactory.decodeStream(new FileInputStream(f),null,o);       
    
                //The new size we want to scale to        
                final int REQUIRED_SIZE=100;        
    
                //Find the correct scale value. It should be the power of 2.        
                int width_tmp=o.outWidth, height_tmp=o.outHeight;        
                int scale=1;        
    
                while(true){            
                    if(width_tmp/2<REQUIRED_SIZE || height_tmp/2<REQUIRED_SIZE)                
                        break;            
                    width_tmp/=2;            
                    height_tmp/=2;            
                    scale*=2;        
                }        
    
                //Decode with inSampleSize        
                BitmapFactory.Options o2 = new BitmapFactory.Options();        
                o2.inSampleSize=scale;        
    
                return BitmapFactory.decodeStream(new FileInputStream(f), null, o2);    
            } 
    
            catch (FileNotFoundException e) {}    
    
            return null;
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My application allows users to take photos with their devices camera app, which are
My application allows users to take a photo using the camera and save it
My application allows user to upload pdf files and store them on the webserver
My application allows the user to enter a numeric value (currency) in a UITextField
Our application allows administrators to add User Properties in order for them to be
I wrote an application which allows people to contribute plugins to extend the functionality.
I have an application that allows the user to download a csv. This works
I have a web application that allows a user to search on some criteria,
My application allows the user to create their own methods indirectly and I later
My application allows the user to insert information into a document (using document properties

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.