开发者

notifyDataSetChanged(); source not found exception?

friends,

i have problem in calling notifydatasetchanged(); it is giving me exception source not found can any one guide me what mistake am i doing? if i assign data on create it works fine. but in case of updating list it wont.

any help would be appriciated.

private static EfficientAdapter adap; //global variable

 @Override
      public void onCreate(Bundle savedInstanceState) {

super.onCreate(save开发者_JAVA百科dInstanceState);
        setContentView(R.layout.listsearched);
if(filevalue== "true")
{
    adap = new EfficientAdapter(this);
setListAdapter(adap);


}


}
  private static void RefreshList()
      {
        data = new String[DalMapSearch.MyPassableObject.size()];
        TitleString=new String[DalMapSearch.MyPassableObject.size()];
        DetailString=new String[DalMapSearch.MyPassableObject.size()];

        int i=0;
        for (DalMapSearch t : DalMapSearch.MyPassableObject)
         {
            data[i]= t.getAd_id();
            TitleString[i]= t.getAd_text();
            DetailString[i]=t.getLocation();
            i=i+1;
         }


        adap.notifyDataSetChanged();

      }


If you outcomment if(filevalue== "true") , is it the same result (source not found) ? Be sure that you dont calling RefreshList() if the adapter isnt set. For exampel if your fileValue == "false" when oncreate the adapter wouldnt be created.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜