i think you should not need to montior the change, one thing you need do is
to change the baseAdapter ,i do like this
public SimpleAdapter initAdapter(
ArrayList<HashMap<String, String>> listDataSource) {
SimpleAdapter mSchedule = new SimpleAdapter(this,
listDataSource,
R.layout.left_ticket_list_item,// ListItem的XML实现
new String[] { String.valueOf(R.string.ret_id),
String.valueOf(R.id.train_no),
String.valueOf(R.id.start_time),
String.valueOf(R.id.arrive_time),
String.valueOf(R.id.esep_time),
String.valueOf(R.id.left_hard_seat),
String.valueOf(R.id.left_hard_berth),
String.valueOf(R.id.left_soft_berth),
String.valueOf(R.id.left_LevOne_Seat),
String.valueOf(R.id.left_LevSec_Seat) }, new int[] {
R.id.query_ret_id, R.id.train_no, R.id.start_time,
R.id.arrive_time, R.id.esep_time,
R.id.left_hard_seat,
R.id.left_hard_berth, R.id.left_soft_berth,
R.id.left_LevOne_Seat, R.id.left_LevSec_Seat });
return mSchedule;
}
public void showQueryLeftTicketRet(
ArrayList<LeftTicketInfo> al_retleftTicketInfo) {
HashMap<String, String> queryRetListMap = new HashMap<String,
String>();
queryRetList.clear();
if (al_retleftTicketInfo.size() == 0) {
this.showQueryRet.setVisibility(0);
} else {
this.showQueryRet.setVisibility(2);
for (int i = 0; i < al_retleftTicketInfo.size(); i++) {
queryRetListMap = new HashMap<String, String>();
queryRetListMap.put(String.valueOf(R.string.ret_id),
al_retleftTicketInfo.get(i).id);
queryRetListMap.put(String.valueOf(R.id.train_no),
al_retleftTicketInfo.get(i).trainNo);
queryRetListMap.put(String.valueOf(R.id.start_time),
al_retleftTicketInfo.get(i).startTime);
queryRetListMap.put(String.valueOf(R.id.arrive_time),
al_retleftTicketInfo.get(i).arriveTime);
queryRetListMap.put(String.valueOf(R.id.esep_time),
al_retleftTicketInfo.get(i).esepTime);
queryRetListMap.put(String.valueOf(R.id.left_hard_seat),
al_retleftTicketInfo.get(i).leftHardSeat);
queryRetListMap.put(String.valueOf(R.id.left_hard_berth),
al_retleftTicketInfo.get(i).leftHardBerth);
queryRetListMap.put(String.valueOf(R.id.left_soft_berth),
al_retleftTicketInfo.get(i).leftSoftBerth);
queryRetListMap.put(String.valueOf(R.id.left_LevOne_Seat),
al_retleftTicketInfo.get(i).leftLevOneSeat);
queryRetListMap.put(String.valueOf(R.id.left_LevSec_Seat),
al_retleftTicketInfo.get(i).leftLevSecSeat);
queryRetList.add(queryRetListMap);
//Log.v("INFO", al_retleftTicketInfo.get(i).id);
}
}
this.queryLeftTicketRetListView.setAdapter(initAdapter(queryRetList)
);
}
2010/6/5 Ramesh Sangili <[email protected]>
> Any help is greatly appreciated!!!
>
> Please guys share your thougths
>
>
> On Sun, May 30, 2010 at 8:01 AM, Ramesh Sangili
> <[email protected]>wrote:
>
>> Guys,
>>
>> I am extending BaseAdapter and trying to populate the List Screen on my
>> Activity Screen. NotifyDataSetChanged is not working as expected. Please
>> find the below snippet of code. Please do let me know your thoughts.
>>
>>
>>
>>
>>
>>
>>
>> public void onCreate(Bundle savedInstanceState) {
>>
>> super.onCreate(savedInstanceState);
>> initialize();
>> context = this;
>> config = Config.getInstance();
>> searchText = new EditText(this);
>> handler = new Handler() {
>> @Override
>> public void handleMessage(Message msg) {
>> msgQueueAdapter.notifyDataSetChanged();
>> context.msgQueueAdapter.notifyDataSetChanged();
>> msgQueueAdapter.notifyDataSetInvalidated();
>> }
>> };
>> searchText.addTextChangedListener( new TextWatcher() {
>> @Override
>> public void onTextChanged(CharSequence s, int start, int before, int
>> count) {
>> // TODO Auto-generated method stub
>> Log.d("on text", "String: " + s);
>> loadData(s.toString());
>> msgQueueAdapter = new ListAdapter(context, msgQueueList);
>> Message msg = handler.obtainMessage();
>> handler.sendMessage(msg);
>> searchText.bringToFront();
>> runOnUiThread(new Runnable() {
>> @Override
>> public void run() {
>> msgQueueAdapter.notifyDataSetChanged();
>> searchText.setCursorVisible(true);
>> searchText.setClickable(true);
>> }
>> });
>> }
>> @Override
>> public void beforeTextChanged(CharSequence s, int start, int count,
>> int after) {
>> }
>> @Override
>> public void afterTextChanged(Editable s) {
>> // TODO Auto-generated method stub
>> }
>> });
>> msgQueueAdapter = new ListAdapter(this, msgQueueList);
>> Log.d("list", "List Display - 1" + msgQueueAdapter);
>> msgQueueListView = this.getListView();
>> msgQueueListView.addHeaderView(searchText);
>> setListAdapter(msgQueueAdapter);
>> msgQueueAdapter.notifyDataSetChanged();
>> this.msgQueueAdapter.notifyDataSetInvalidated();
>> }
>>
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en