android - Can't Find nullpointer please assist -


this class gain null pointer points line 65.

 public class searchlist extends listactivity    {  @override protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);     new loadsomestuff().execute(); }  public class loadsomestuff extends asynctask<string, integer, string[]> {   progressdialog dialog;    protected void onpreexecute()   {      dialog = new progressdialog(searchlist.this);       dialog.setprogressstyle(progressdialog.style_spinner);      dialog.setmax(100);      dialog.show();   }     @override     protected string[] doinbackground(string... arg0) {         // todo auto-generated method stub          for(int =0; i<20; i++)         {           publishprogress(5);           try           {           thread.sleep(80);           } catch(interruptedexception e)           {               e.printstacktrace();           }         }         dialog.dismiss();         int loops = search_page.returnlooped();         int[] teacup = search_page.returnnumarray();         sqlstuff searching = new sqlstuff(searchlist.this);         string[] idsysnames = searching.getidsysname();         searching.close();          string[] resultlist = new string[loops];         for(int i=0; < loops; i++ )         {             if(idsysnames[teacup[i]] != null)             {              resultlist[i].equals(idsysnames[teacup[i]]);    //line 65               }         }          setlistadapter(new arrayadapter<string>(searchlist.this, android.r.layout.simple_list_item_1, resultlist));         return null;     }      protected void onprogressupdate(integer...progress)     {         dialog.incrementprogressby(progress[0]);     } } 

this getidsysname class used class above.

 public string[] getidsysname() {     string[] result = new string[0];      try     {         string[] columns = new string[] {key_sysname};         cursor c  =  chempal.query(database_table, columns, null, null, null, null, null);         log.d("sqldstuff", "cursor count: "+c.getcount());         int isysname = c.getcolumnindex(key_sysname);          int = 0;         (c.movetofirst(); !c.isafterlast(); c.movetonext()){             i++;         }          result = new string[i];         = 0;         (c.movetofirst(); !c.isafterlast(); c.movetonext()){             result[i] = c.getstring(isysname);             i++;          }     }     catch(exception e)     {         }      return result; } 

if else needed please ask in comments because frustrating me @ moment. thank you

you've allocated array of strings:

string[] resultlist = new string[loops]; (int i=0; < loops; i++ ) {     if (idsysnames[teacup[i]] != null) {         resultlist[i].equals(idsysnames[teacup[i]]);    //line 65  

there aren't strings in upon call equals.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -