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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:35:07+00:00 2026-05-27T07:35:07+00:00

The getter and setter class is becoming NULL when i try to fetch values

  • 0

The getter and setter class is becoming NULL when i try to fetch values form it.
in the code below, plz read the comments, i have added, for the explanation.
i have spent too much time on it and not getting whats the problem there… I m struck !!
I jst want to get the CategoryID and File and append them to the URL to show thumbnails on each row of my ListView.
I have done changes many times but not working…

public class MySimpleArrayAdapter extends ArrayAdapter<String>
{

////** Create Object For SiteList Class */
SitesList sitesList = null;   //////// This is my Custom SitesList Class that contains ArrayLists

public Context context;
public ArrayList<String> siteslist;

public MySimpleArrayAdapter(Context context, ArrayList<String> siteslist)
{
    super(context, R.layout.row, R.id.tv_label, siteslist);
    this.context = context;
    this.siteslist = siteslist;   //////// Uptill here, the Siteslist is picking all desired values and storing in it
}

public View getView(int position, View convertView ,ViewGroup parent)
{
    View v = convertView;

    if(v == null)
    {
        LayoutInflater inflator = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v= inflator.inflate(R.layout.row, null);
    }

    TextView tv_name = (TextView) v.findViewById(R.id.tv_label);
    tv_name.setText(siteslist.get(position));

    ImageView thumbnail = (ImageView) v.findViewById(R.id.iv_left);

    //////// But here the sitesList becomes **NULL**
String categoryid = sitesList.getcategoryid().get(position).toString();   

    final String url = "http://dev.takkekort.no/page/designer/masks/" + categoryid +"/front/landscape/" + file ;

////////////// I want to use the above String url in the GetImage Class below to fetch each image and show it as a thumbnail in the listview.

    new GetImage(url).execute(thumbnail);

    return v;
}
}

And here is my SitesList Class which contains getter ans setter methods

/** Contains getter and setter method for varialbles */
public class SitesList
{

    /** Variables */
    public ArrayList<String> categoryid = new ArrayList<String>();

    /**
     * In Setter method default it will return arraylist change that to add
     */

    public ArrayList<String> getcategoryid()    ////////// Category ID
    {
        return categoryid;
    }

    public void setcategoryid(String categoryid)
    {
        this.categoryid.add(categoryid);
    }

}

Kindly update my code if possible.

Thanks in 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-05-27T07:35:08+00:00Added an answer on May 27, 2026 at 7:35 am

    As pointed out in another answer, you’ve got two different variables that differ only in the case of a single letter – sitesList vs siteslist. This is valid in Java, but a very bad idea. It’s already confused most of the answerers and yourself as well.

    Start by removing the one you don’t want to use or, if both are needed, rename one of them to a more distinct name and I think it’ll become more clear where your problem is.

    You set sitesList (capital ‘L’) here:

    SitesList sitesList = null;
    

    And don’t do anything else with it until here:

    String categoryid = sitesList.getcategoryid().get(position).toString(); 
    

    It didn’t become null, it was never anything else. Now you are also doing something with another object named siteslist (lower-case ‘L’), which is where your confusion is occurring.

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

Sidebar

Related Questions

Try running the following code: class Test(object): def func_accepting_args(self,prop,*args): msg = %s getter/setter got
In my ActionScript3 class, can I have a property with a getter and setter?
I have an Objective-C NSMutableDictionary declared inside a class's @interface section, with getter/setter methods,
I am working on struts2 application. I have getter/setter in my action class. Now,
I have a class with a property called title and I have a getter/setter
I am using a magic getter/setter class for my session variables, but I don't
I want Eclipse to automatically generate Javadoc comments for my getter and setter methods
Imagine the following template class (setter and getter for the member _t omitted): template<class
If a class contains a variable named blah, then the standard getter/setter syntax is
I am trying to define simple getter/setter methods for a mixin class that I

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.