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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:45:17+00:00 2026-06-05T12:45:17+00:00

I need to display an image in my android application. The problem is I

  • 0

I need to display an image in my android application. The problem is I want to get this image from somewhere online. The URL is like:

http://www.mydomain.com/hello world image.png

As you see the image name containing some spaces in it. Every time I execute my code this will show me exception of FileNotFound. and nothing happens.

Following is my code

String imagePathCon = "hello world image.png";      
String imagePath = "http://www.mydomain.com/" + imagePathCon;
try {
  URL url;
  url = new URL(imagePath);

  // url = new URL("http://www.azuma-kinba.com/wp-content/uploads/2012/05/Android-Make-Google-Loss-in-2010.png");

  InputStream content = (InputStream)url.getContent();
  Drawable d = Drawable.createFromStream(content , "src"); 
  im.setImageDrawable(d);

 } catch (MalformedURLException e) {
            e.printStackTrace();
 } catch (IOException e) {
            e.printStackTrace();
 }

I use to replace space with “+” but nothing happens.

  • 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-05T12:45:18+00:00Added an answer on June 5, 2026 at 12:45 pm

    This will work.

    String imagePathCon = "hello world image.png";   
    imagePathCon=imagePathCon.replaceAll(" ", "%20");
    
    String imagePath = "http://www.mydomain.com/" + imagePathCon;
    

    You must know http://en.wikipedia.org/wiki/Percent-encoding#Character_data

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

Sidebar

Related Questions

Hey I need to display an image read from socket in my android application.The
I'm using andengine in my Android application and would like to display images from
I am writing an Android application where I need to display Image Captured through
This is my requirement in Android . I need to display a tiny image.
In my application, we need to display the Video frame receives from server to
In my application I need to display questions along with images in Android. I
In an Android Application - I am sending a Json String like this {restarutant:{name:Chung
I need to create a gallery type application. Where i need display many image
In my android app I need to display in a gridview images from a
In my android app I need to display a text on an image. The

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.