Monday 15 February 2010

java - Trying to pass data from ListView to another class -


So I got stuck on it for hours. I am trying to set up an async job that will load images for my listview in another category and I am passing information that gives me an error

Any help would be appreciated!

increases public class results activity {

  public static final string DEFAULTNAME = "DefaultFile"; Private GETTHEIMAGE imgFetch; Private Arrest & amp; Lt; Item_Info & gt; Info = New Arrestist & lt; Item_info & gt; (); String data = null; String threshold = null; TextView httpStuff; @ Override protected void saved create (bundled Instansstet) {Suprknkret (saved Instensstet); // Full Screen Request WindowFeature (Window.FEATURE_NO_TITLE); GetWindow () Set Flag (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); SetContentView (R.layout.theresults); SharedPreferencesSearch = getSharedPreferences (DEFAULTNAME, 0); Data = search .getString ("Thrasults", blank); Information (); Populatelist (); } Private Zero GetINFO () {}}} Private Zero Populatist () {Array Adapter & lt; Item_info & gt; Adapter = new TheListAdapter (); List View List = (List View) ViewById (R.id.listings); List.findFocus (); List.getWindowToken (); List.setAdapter (adapter); } Public class TheListAdapter ArrayAdapter and lt; Item_Info & gt; {Public TheListAdapter () {Super (The results .a, R.Let.Items, Info); } @ Override public view getView (see the status of int, seeviewview, ViewGroup parent) {see item_View = convertView; ImageHolder holder = null; If (item_view == faucet) {item_view = getLayoutInflater (). Flowers (R. Lateite. Items, Parents, False); Item_Info current item = Info.get (status); Holder = new picture holder (); Holder. ICNiG = (image view) item_view.findvibid (RID.Con_Is); Holder.ICON_IMG.setTag (CurrentItem.getItemPIC ()); Drawable MYIMG = imgFetch.GetTheImagedata (this, holder. ICON_IMG); Holder .ICON_TITLE = (TextView) item_View.findViewById (R.id.icon_title); Holder.ICON_TITLE.setText (CurrentItem.getItemTITLE ()); Holder .ICON_LOCATION = (TextView) item_View.findViewById (R.id.icon_location); Holder.ICON_LOCATION.setText (CurrentItem.getItemLOCATION ()); Holder .ICON_PRICE = (TextView) item_View.findViewById (R.id.icon_price); If (CurrentItem.getItemPRICE () == faucet) {holder.ICON_PRICE.setText (CurrentItem.getItemPRICE ()); Holder.ICON_PRICE.setBackgroundResource (R.drawable.tempbg); } Other {holder .ICON_PRICE.setBackgroundResource (R.drawable.pricebg); Holder.ICON_PRICE.setText (CurrentItem.getItemPRICE ()); } Holder. ICNDET = (text view) item_view.findvibidid (rid.con_date); Holder.ICON_DATE.setText (CurrentItem.getItemLOCATION ()); } Else {holder = (ImageHolder) item_View.getTag (); } Return item_view; }} Fixed square image holder {ImageView ICON_IMG; TextView ICON_TITLE; TextView ICON_LOCATION; TextView ICON_PRICE; TextView ICON_DATE; }   

}

After looking at the logs after the line 06-21 19: 15: 06.887: E / Android Random (11408): Fatal exception: main

is an exception

 < Code> java.lang.NullPointerException   

which tells us that something is null and it is throwing exceptions if we search the first line of code that When you reference your project, we will see where the problem is. Here, this logcat has the next line

  com.clistc.TheResults tells us at $ TheListAdapter.getView (TheResults.java:178)   

That line is 178's TheResults.java and it is within the getView () method. We have established that this line is

  DREAM MYIMG = imgFetch.GetTheImagedata (this, holder. ICON_IMG);   

means that imgFetch is probably null and you try to call the function which is null < / Code> because variable is zero I do not know what that variable is, but it is not being initialed before this line

edit

imgFetch is not started anywhere

  Private Getimage IMGafet;   

But you do not start it at any time by giving it a price. You need to do something like this

  private GETTHEIMAGE imgFetch = new GETTHEIMAGE ();   

Assume that there is an empty constructor in it

No comments:

Post a Comment