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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:19:14+00:00 2026-06-14T10:19:14+00:00

update: The code is fine. It was simply a wrong pointer to the database.

  • 0

update: The code is fine. It was simply a wrong pointer to the database.

I’m using JSONParser method to make http request to get JSON data and returns a JSONObject from database. There is no problem getting the JSONObject and display the String such as the name and email, but It does not retrieving the URL of the images.
I don’t get any error but it’s just displaying empty fields.

However, if I make this line from

String imageURL = directory.getString(TAG_IMG);

to this

String imageURL = "http://mywebsite.com/images/photo1.png";

It works fine.

//URL to make request
private static final String url_veiw_directory = "http://www.myweb.com/android/include/directory_detail_me.php";

private static final String TAG_SUCCESS = "success";
private static final String TAG_DIRECTORY = "directory";
private static final String TAG_ID = "user_id";
private static final String TAG_IMG = "photo"; // Image URLs stored in the DB
private static final String TAG_NAME = "name";
private static final String TAG_EMAIL = "email";

//Get JSONObject by httpRequest
JSONObject json = jsonParser.makeHttpRequest(url_veiw_directory, "GET", params);

Log.d("my profile", json.toString());

 if (success == 1) {

    JSONArray directoryObj = json.getJSONArray(TAG_DIRECTORY);  

    JSONObject directory = directoryObj.getJSONObject(0);

    //User Image                            
    int loader = R.drawable.loader; 

    String imageURL = directory.getString(TAG_IMG);                         
    ImageView imagePhoto = (ImageView) findViewById(R.id.photo);

    ImageLoader imgLoader = new ImageLoader(getApplicationContext());        
    imgLoader.DisplayImage(imageURL, loader, imagePhoto);

    //User Name and Email                           
    TextView txtName = (TextView) findViewById(R.id.name);
    TextView txtEmail = (TextView) findViewById(R.id.email);                            

    txtName.setText(directory.getString(TAG_NAME));
    txtEmail.setText(directory.getString(TAG_EMAIL));

//Image Loader Class

public void DisplayImage(String url, int loader, ImageView imageView)
    {
        stub_id = loader;
        imageViews.put(imageView, url);
        Bitmap bitmap=memoryCache.get(url);
        if(bitmap!=null)
            imageView.setImageBitmap(bitmap);
        else
        {
            queuePhoto(url, imageView);
            imageView.setImageResource(loader);
        }
    }

    private void queuePhoto(String url, ImageView imageView)
    {
        PhotoToLoad p=new PhotoToLoad(url, imageView);
        executorService.submit(new PhotosLoader(p));
    }

    private Bitmap getBitmap(String url)
    {
        File f=fileCache.getFile(url);

        //from SD cache
        Bitmap b = decodeFile(f);
        if(b!=null)
            return b;

        //from web
        try {
            Bitmap bitmap=null;
            URL imageUrl = new URL(url);
            HttpURLConnection conn = (HttpURLConnection)imageUrl.openConnection();
            conn.setConnectTimeout(30000);
            conn.setReadTimeout(30000);
            conn.setInstanceFollowRedirects(true);
            InputStream is=conn.getInputStream();
            OutputStream os = new FileOutputStream(f);
            ImageUtils.CopyStream(is, os);
            os.close();
            bitmap = decodeFile(f);
            return bitmap;
        } catch (Exception ex){
           ex.printStackTrace();
           return null;
        }
    }
  • 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-14T10:19:15+00:00Added an answer on June 14, 2026 at 10:19 am

    Most likely reason is that imageURL string is ether empty or what maybe more likely (since you are pulling it from DB) it’s escaped to the form that makes it unusable as URL. I would suggest to print it out and see the value at which point you probably can unescape it or do some character substitution

    You may see something like http%3A//mywebsite.com/images/photo1.png

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

Sidebar

Related Questions

My code looks fine but it is not working as it should because update
I am using following steps to update code on server after login to server:
I am trying to use batch updates in Access VBA. My code works fine
I am trying to update code via Linq, but I am getting this error:
suppose you update your code to revision 10 which is broken. You want to
I'm trying to update my code to use cv2.SURF() as opposed to cv2.FeatureDetector_create(SURF) and
I have the following code: UPDATE myTable SET Col1 = @Value However, I have
Here is my upsert code: UPDATE LastTicket SET LastTicketNumber=LastTicketNumber+1 OUTPUT INSERTED.LastTicketNumber WHERE CategoryId='1'; IF
I am trying to use ajax to update the views which simply checking results
I have a sproc that is called from .net code which does an update

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.