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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:58:18+00:00 2026-06-14T20:58:18+00:00

i had list adapter for load image as icon list from server. i guess

  • 0

i had list adapter for load image as icon list from server. i guess i had no critical problems in my adapter but i still got error even i’ve already edited my code. i used asynctask class to load data from server. here my adapter code :

    public class ListAdapterImage extends BaseAdapter{

    private Activity activity;
    private Runnable runnable;
    private ArrayList<HashMap<String, String>> data;
    private static LayoutInflater inflater=null;
    public ImageLoader imageLoader;

    public ListAdapterImage (Activity a, ArrayList<HashMap<String, String>> data) {
        activity = a;
        this.data=data;
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        imageLoader=new ImageLoader(activity.getApplicationContext());
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public View getView(int position, View v, ViewGroup parent) {

         View vi=v;
            if(v==null)
                vi = inflater.inflate(R.layout.list_row, null);

            TextView Pk_Merchant_ID = (TextView) vi.findViewById(R.id.tv_id);
            TextView Descriptions = (TextView) vi.findViewById(R.id.tv_groupname);
            TextView Address = (TextView) vi.findViewById(R.id.tv_merchantname);
            ImageView imgythumb = (ImageView) vi.findViewById(R.id.list_images);

            HashMap<String, String> datas = new HashMap<String, String>();
                datas = data.get(position);

            Pk_Merchant_ID.setText(datas.get("Pk_Merchant_ID"));
            Descriptions.setText(datas.get("Descriptions"));
            Address.setText(datas.get("Address"));
            imageLoader.DisplayImage(datas.get("Path_PhotoProfile"), imgythumb);
        return vi;
    }

}

in my logcat some errors like this :

11-10 22:52:02.732: E/AndroidRuntime(26274): FATAL EXCEPTION: main
11-10 22:52:02.732: E/AndroidRuntime(26274): java.lang.NullPointerException
11-10 22:52:02.732: E/AndroidRuntime(26274):    at com.example.adapter.ListAdapterImage.<init>(ListAdapterImage.java:30)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at com.example.main.ResultRestoActivity$LoadData$1.run(ResultRestoActivity.java:271)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at android.app.Activity.runOnUiThread(Activity.java:3743)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at com.example.main.ResultRestoActivity$LoadData.onPostExecute(ResultRestoActivity.java:258)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at com.example.main.ResultRestoActivity$LoadData.onPostExecute(ResultRestoActivity.java:1)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at android.os.AsyncTask.finish(AsyncTask.java:417)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at android.os.AsyncTask.access$300(AsyncTask.java:127)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at android.os.Looper.loop(Looper.java:130)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at android.app.ActivityThread.main(ActivityThread.java:3691)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at java.lang.reflect.Method.invokeNative(Native Method)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at java.lang.reflect.Method.invoke(Method.java:507)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
11-10 22:52:02.732: E/AndroidRuntime(26274):    at dalvik.system.NativeStart.main(Native Method)

in my activity, i set my adapter in onPostExecute :

    @Override
    protected void onPostExecute(String s) {
        pDialog.dismiss();
        runOnUiThread(new Runnable() {
            @Override
            public void run() {  
                adapter = new ListAdapterImage(null, listData);
                lv.setAdapter(adapter);
            }
        });
    }

need all of your helps and comments immediately. thanks for advance.

  • 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-14T20:58:19+00:00Added an answer on June 14, 2026 at 8:58 pm

    you are passing null here..

    adapter = new ListAdapterImage(null, listData);
    

    and then in this piece of code

    public ListAdapterImage (Activity a, ArrayList<HashMap<String, String>> data) {
        activity = a;
        this.data=data;
        //Problem
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        imageLoader=new ImageLoader(activity.getApplicationContext());
    }
    

    pass adapter = new ListAdapterImage(yourActivityName.this, listData);

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

Sidebar

Related Questions

I Had Drop down list and I want to fill it with data from
I've had problems with Internet Explorer not applying the last property in a list
Had to download Command Line Tools from Apple to get make to work, but
Sorry if I repeat my question but I have still had no clues of
When I had a Typed DataTable with information retrieved from a SQL Server with
I had a list with one column which worked with an adapter, and it
I had a list contains images, each time the user clicked on the image
If i had a list of balls each of which has a color property.
I heard this today during interview for java developer. I had to list some
Let's say I had: protected void performLogic(List<Object> docs) { ... } In the code

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.