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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:05:45+00:00 2026-05-16T11:05:45+00:00

I am developing an app in android, which basically visits a given url and

  • 0

I am developing an app in android, which basically visits a given url and downloads an image.

Now i want to populate this downloaded image and show it in thumbnail view.

I have tried out displaying the same from SD Card, but when i am doing the same for downloaded files, it doesn’t seems to work.

public View getView(int position,View convertView,ViewGroup parent)                
{  
  System.gc();  
  ImageView i = new ImageView(mContext.getApplicationContext());  
    if (convertView == null)    
    {  
          //imagecursor.moveToPosition(position);  
          //int id = imagecursor.getInt(image_column_index);  
          //i.setImageURI(Uri.withAppendedPath(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, ""+ id));  
          i.setImageBitmap(bitmap);  
          i.setScaleType(ImageView.ScaleType.FIT_CENTER);  
          i.setLayoutParams(new GridView.LayoutParams(100, 100));  
    }  
    else  
    {  
       i = (ImageView) convertView;
    }
    return i;  
}
  • 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-16T11:05:45+00:00Added an answer on May 16, 2026 at 11:05 am

    You can download the file and write it to the storage using URL, HttpConnection & Inputstream/Outputsteam. Once its downloaded you can display it in your ImageView.

    I had done this using an AsyncTask:

    @Override
            protected Void doInBackground(URL... urls) {
                for (int i = 0; i < urls.length; i++) {
    
                    try {
    
                        Pattern pattern = Pattern.compile("([a-zA-Z]*.[jpeg|png])$");
                        Matcher matcher = pattern.matcher(urls[i].getFile());
    
                        if (matcher.find()) {
    
                            URLConnection connection = urls[i].openConnection();
                            int fileSize = connection.getContentLength();
                            mFileName = matcher.group();
    
                            String filePath = Environment
                                    .getExternalStorageDirectory()
                                    + File.separator + mFileName;
    
                            InputStream input = new BufferedInputStream(urls[i]
                                    .openStream());
    
                            OutputStream output = new FileOutputStream(filePath);
    
                            byte data[] = new byte[1024];
    
                            long total = 0;
                            int count;
    
                            while ((count = input.read(data)) != -1) {
                                total += count;
                                int value = (int) (total * 100 / fileSize);
                                output.write(data, 0, count);
                                onProgressUpdate(value);
                            }
    
                            output.flush();
                            output.close();
                            input.close();
    
                            // Now display the image in your ImageView
    
                        }
    
                    } catch (IOException e) {
    
                        e.printStackTrace();
                    }
                }
                return null;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an Android app which gets an image encoded in base 64
I am very new to android and I am developing this app which allows
I am developing an android app in which i want to send (name,email, cell
I am developing an android app in which I want to find the latitude
I am developing some app for android which worked well untill this evening. However
I am developing an android app which needs to activate the GPS. I read
I'm developing an Android app which is a quiz. On the other hand, I'm
I am developing an android app in which I have included a library project,
I am developing a basic android app which must handle several different things typically
We are developing a mobile app in Android and iPhone which has a server-side

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.