Note that there are some explanatory texts on larger screens.

plurals
  1. PONull Pointer Expetion in getting value from class
    primarykey
    data
    text
    <p>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...</p> <pre><code>public class MySimpleArrayAdapter extends ArrayAdapter&lt;String&gt; { ////** Create Object For SiteList Class */ SitesList sitesList = null; //////// This is my Custom SitesList Class that contains ArrayLists public Context context; public ArrayList&lt;String&gt; siteslist; public MySimpleArrayAdapter(Context context, ArrayList&lt;String&gt; 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; } } </code></pre> <p>And here is my SitesList Class which contains getter ans setter methods</p> <pre><code>/** Contains getter and setter method for varialbles */ public class SitesList { /** Variables */ public ArrayList&lt;String&gt; categoryid = new ArrayList&lt;String&gt;(); /** * In Setter method default it will return arraylist change that to add */ public ArrayList&lt;String&gt; getcategoryid() ////////// Category ID { return categoryid; } public void setcategoryid(String categoryid) { this.categoryid.add(categoryid); } } </code></pre> <p>Kindly update my code if possible.</p> <p>Thanks in advance !!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload