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

  • Home
  • SEARCH
  • 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 6096481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:55:56+00:00 2026-05-23T12:55:56+00:00

Hello everyone please guide whats wrong with this code that image is not visible

  • 0

Hello everyone please guide whats wrong with this code that image is not visible in the list , although space and other description of the image is available , Thanks

public class Test extends ListActivity  {
      Prefs myprefs = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listplaceholder);
        this.myprefs = new Prefs(getApplicationContext());
        // install handler for processing gui update messages
        ArrayList<HashMap<String, Object>> mylist = new ArrayList<HashMap<String, Object>>(); 
       JSONObject json = JSONfunctions.getJSONfromURL("http://midsweden.gofreeserve.com/proj/androidjson.php?identifier=" + 
        Test.this.myprefs.getPersonalno());

        try{

            JSONArray  earthquakes = json.getJSONArray("services");

            for(int i=0;i<earthquakes.length();i++){                        
                HashMap<String, Object> map = new HashMap<String, Object>();
                 JSONObject e = earthquakes.getJSONObject(i);

                map.put("id", e.getString("taskid"));
                map.put("pic", "Service name : " + e.getString("employeepic"));
                map.put("serviceinfo", "" +  e.getString("employeename")+ " : "+ e.getString("starttime")
                        +" To " +  e.getString("endtime"));

                  BmpFromURL  myBmpFromURL = new BmpFromURL("http://midsweden.gofreeserve.com/proj/admin/pictures/file87619.jpg");
                  Bitmap myBitmap = myBmpFromURL.getMyBitmap();
                    map.put("img",myBitmap);
                mylist.add(map);            
            }       
        }catch(JSONException e)        {
             Log.e("log_tag", "Error parsing data "+e.toString());
        }

        SimpleAdapter adapter = new SimpleAdapter(this, mylist , R.layout.test,new String[] {"img", "servicename", "serviceinfo" }, 
                        new int[] {  R.id.image ,R.id.item_title, R.id.item_subtitle });

        setListAdapter(adapter);

        final ListView lv = getListView();
        lv.setTextFilterEnabled(true);  
        lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {              
                @SuppressWarnings("unchecked")
                HashMap<String, String> o = (HashMap<String, String>) lv.getItemAtPosition(position);                   
                Toast.makeText(Test.this, "ID '" + o.get("id") + "' was clicked.", Toast.LENGTH_SHORT).show(); 

            }
        });

    }



    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.settings:     
                Intent intent = new Intent(this, ShowSettings.class);
                  startActivity(intent);
            break;

            case R.id.web:     
                Intent intent4 = new Intent(this, MenuActivity.class);
                  startActivity(intent4);
            break;


            case R.id.services:     
                Intent intent2 = new Intent(this, Test.class);
                startActivity(intent2);
              break;
            case R.id.Quit: 

                Intent intent3 = new Intent(this, ServicesDemo.class);
                startActivity(intent3);

                break;
            default:    
            break;
        }
        return true;
    }
}

Here is Bitmap class

public class BmpFromURL {


    private Bitmap myBitmap;


    public BmpFromURL(String imageURL){



    URL myImageURL = null;


    try {

    myImageURL = new URL(imageURL);

    } catch (MalformedURLException error) {


    error.printStackTrace();

    }


    try {

    HttpURLConnection connection = (HttpURLConnection)myImageURL .openConnection();

    connection.setDoInput(true);

    connection.connect();

    InputStream input = connection.getInputStream();

    myBitmap = BitmapFactory.decodeStream(input);

    } catch (IOException e) {


    e.printStackTrace();

    }

    }


    public Bitmap getMyBitmap() {

    return myBitmap;

    }
}

Here is the xml file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:cacheColorHint="#55000000"
    android:background="#55000000"
    >
      <ImageView
      android:id="@+id/image"
      android:layout_width="50dip"
      android:layout_height="50dip"
      />
<TextView  

    android:id="@+id/item_title"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:padding="2dp"
    android:textSize="20dp" />
    <TextView  
    android:id="@+id/item_subtitle"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:padding="2dp"
    android:textSize="18dp" />
</LinearLayout>
  • 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-23T12:55:57+00:00Added an answer on May 23, 2026 at 12:55 pm

    Please used below lazy load of images in ListView

    Source is available here http://open-pim.com/tmp/LazyList.zip

    GitHub: https://github.com/thest1/LazyList

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

Sidebar

Related Questions

Hello can anybody solve this please I'm creating the object in the action class
Hello I am working with a simulator that uses rcS scripts to boot, this
Hello everyone~ I have a problem to solve~ I have created a server that
hello everyone i have a problem with my 3-tiers application i don't know how
Possible Duplicates: Downloading a file in Delphi Delphi File Downloader Component Hello everyone, I'm
hello every one i have table view with one cell,and i make on this
I frequently do this sort of thing: class Person(object): def greet(self): print Hello class
Hello I have the following error by git-fsck, which cannot be cleaned by git-gc
Hello again ladies and gents! OK, following on from my other question on ASP.NET
Hello I was writing a Regular Expression (first time in my life I might

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.