Android How sort and reverse sort in single Button clcik?

Use a Boolean field whose initial value is true. In click handler of button, compare the boolean field value, if it is true then do sort and set false to boolean field. If boolean value is false then do reverse and set true to boolean field.

Use a Boolean field whose initial value is true. In click handler of button, compare the boolean field value, if it is true then do sort and set false to boolean field. If boolean value is false then do reverse and set true to boolean field.

Boolean state=true; btn. SetOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(state) { //sort state=false; } else{ //reverse state=true; } } }).

Thanks AVD, The Boolean logic working . – jalakam Sep 20 at 6:11 The sort working only first header clicking with respect to first column data, when ever I click the second header column it's sorting with respect to first column data, not second column data, how can I do this issue. – jalakam Sep 20 at 6:16 @jalakam: along with "state" field you can also declare another field which holds the information about header.

If header is 1st then assign value 1, if second header is selected then assign value 2 and so on. – AVD Sep 20 at 6:34 How can I differentiate each Header information, below I declare list of object like this, 'pastebin. Com/XD6T0rFD'; from this how can I differentiate.

– jalakam Sep 20 at 6:42.

All your code is doing is sorting the list in reverser order. Collections.reverseOrder() returns a comparator to reverse. And you pass bb comparator to Collections.

Sort method which reverse the collection. From java doc, Sorts the specified list according to the order induced by the specified comparator. You should sort it after you reverse it.

Ya, but I sort and revers sort in consecutive click in same Button event, so I want to some conditions. – jalakam Sep 20 at 6:18.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions