Need help on List Adapter

by Ramesh Sangili » Sun, 30 May 2010 10:32:01 GMT


Sponsored Links
 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();
}

--



Need help on List Adapter

by Ramesh Sangili » Sat, 05 Jun 2010 10:58:46 GMT


 Any help is greatly appreciated!!!

Please guys share your thougths





--


Sponsored Links


Need help on List Adapter

by igo where » Sat, 05 Jun 2010 12:43:11 GMT


  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,// ListItemML
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(queryR



Need help on List Adapter

by Indicator Veritatis » Sat, 05 Jun 2010 13:09:44 GMT


 My main thought on glancing at this is: you are more likely to get the
help you want if you tell us more. What, for example, do you expect
NotifyDataSetChanged() to do? What data has changed, and what View are
you expecting needs to be updated to reflect the change?

Maybe you will luck out and find a reader more willing to do "code
diving", but I am not in the mood to reverse-engineer your code to
figure out the answers to these questions tonight myself.





--



Need help on List Adapter

by Tommy » Tue, 08 Jun 2010 02:57:14 GMT


 re you getting any errors? what do you mean by NofifyDataSetChanged is not
working as expected?



From: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] On Behalf Of Ramesh Sangili
Sent: Friday, June 04, 2010 10:58 PM
To: android-developers@googlegroups.com
Subject: [android-developers] Re: Need help on List Adapter



Any help is greatly appreciated!!!



Please guys share your thougths

On Sun, May 30, 2010 at 8:01 AM, Ramesh Sangili <ramesh.sang...@gmail.com>
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,




Need help on List Adapter

by Ramesh Sangili » Thu, 10 Jun 2010 01:19:29 GMT


  would like to display the list dynamically filtered by the text input
entered by the user on the textbox. the Problem that I am facing
NotifyDataSetChanged() is refreshing the list based on the text input

On Tue, Jun 8, 2010 at 12:26 AM, Tommy <droi...@gmail.com> wrote:

>



Other Threads

1. How to get the Count for the Outgoing SMS in between the particular date

Hi,

in Android Mobile i need to get the SMS count for the outgoing message
between the particular date /  or taken the count from the given date
to the current Date.


as the same like the call counts also out going call counts

Please Help me to found that  email me to my Id :
damu...@gmail.com


Thank you


--~--~---------~--~----~------------~-------~--~----~

2. develop picasa in android

i modify the android source code.after capture a picture i want to
upload this image to picasa.when run the application,it shows  Could
not find class 'com.google.gdata.client.photos.PicasawebService',
referenced from method com.google.gdata.client.photos.PicasawebService
$Versions.<clinit>.can anyone help,thanks

--~--~---------~--~----~------------~-------~--~----~

3. French Version Of Datepicker

4. WifiReceiver not part of SDK 1.5???

5. how to package several android projects

6. R.arawable visuals

7. is there a cdma flip-phone coming?