How to make Button single click event - android

My rows contain a button that has its own click listener set in my adapter's
When I click on a button it sets the button text "yes' and again click than change it to "No" properly, my problem is as I scroll through the list its setting it for different rows as well. I assume theirs an issue somewhere with views recycling. and when i scroll list then changed text button needs double click to again change button text. but i want it on single click.
what should i have to do?
Here's my code:
public class ListAdapter extends ArrayAdapter<Model> {
customButtonListener customListner;
public interface customButtonListener {
public void onButtonClickListner(int position, Model model);
}
public void setCustomButtonListner(customButtonListener listener) {
this.customListner = listener;
}
private Context context;
private ArrayList<Model> data = new ArrayList<Model>();
public ListAdapter(Context context, ArrayList<Model> dataItem) {
super(context, R.layout.row, dataItem);
this.data = dataItem;
this.context = context;
}
#Override
public View getView(final int position, View convertView, ViewGroup parent) {
final ViewHolder viewHolder;
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(context);
convertView = inflater.inflate(R.layout.row, null);
viewHolder = new ViewHolder();
viewHolder.text = (TextView) convertView
.findViewById(R.id.childTextView);
viewHolder.text1 = (TextView) convertView
.findViewById(R.id.childTextView1);
viewHolder.button = (Button) convertView
.findViewById(R.id.childButton);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
final Model model = getItem(position);
viewHolder.text.setText(model.getNames());
viewHolder.button.setTag(1);
viewHolder.button.setText(model.getYes());
viewHolder.button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
int status = (Integer) v.getTag();
if (status == 1) {
model.setYes("Yes");
viewHolder.button.setText("Yes");
v.setTag(0);
} else {
model.setYes("No");
viewHolder.button.setText("No");
v.setTag(1);
}
}
});
return convertView;
}
public class ViewHolder {
ViewHolder viewHolder;
TextView text, text1;
Button button;
}
}

you need to remove viewHolder.button.setTag(1); from code. This code actually changes the tag previously set to 0 to 1.So 2 click is required to change it again to 1 then change is reflected in ui.

This is a common problem in listview.You can overcome it with getViewTypeCount() and getItemViewType(int position) methods.
Add this two methods in your adapter like:
#Override
public int getViewTypeCount() {
// TODO Auto-generated method stub
return 2;//The number of conditions that may occur in listview
}
#Override
public int getItemViewType(int position) {
// TODO Auto-generated method stub
if (status == 1) {
return 1;
} else {
return 0;
}
}
Then in getView() method:
int type=getItemViewType(position);
if(type==1)
{
model.setYes("Yes");
viewHolder.button.setText("Yes");
v.setTag(0);
}else{
model.setYes("No");
viewHolder.button.setText("No");
v.setTag(1);
}
To know more about this two methods you can see this and also this.
And tutorials: here and here.
This problem will not occur again if you correctly implement this 2 methods.

Related

notifyDatasetChanged is not working inside the getView() method for Custom Adapter In Android

I am basically trying hide and show a text in the list row when I am clicking a button in the list row. I have added the onClick() for the button inside getView() method and then calling the notifyDataSetChanged(). But it is not working. No change in the text visibility. Here is my custom Adapter code:
public class ListAdapter extends BaseAdapter {
private Context context;
private List<String> mListQuestion = null;
private List<String> mListAnswer = null;
ViewHolder holder = null;
boolean flag = false;
public ListAdapter(Context context, List<String> question, List<String> answer ) {
this.mListQuestion = question;
this.mListAnswer = answer;
this.context = context;
}
#Override
public Object getItem(int position)
{
return mListQuestion.get(position);
}
#Override
public long getItemId(int position) {
return position;
}
#Override
public int getCount() {
return mListQuestion.size();
}
#Override
#SuppressWarnings("deprecation")
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null)
{
LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = vi.inflate(R.layout.list_faq_item, null);
holder = new ViewHolder();
holder.tvQuestion = (TextView) convertView.findViewById(R.id.text);
holder.tvAns = (TextView) convertView.findViewById(R.id.anstext);
holder.ivArrow = (Button)convertView.findViewById(R.id.arrow_expand);
convertView.setTag(holder);
}
else
{
holder = (ViewHolder) convertView.getTag();
}
holder.tvQuestion.setText(mListQuestion.get(position));
holder.tvAns.setText(mListAnswer.get(position));
holder.ivArrow.setOnClickListener(new View.OnClickListener()
{
#Override
public void onClick(View v)
{
if (flag == false)
{
Logger.d("arrow clicked when flag is false");
holder.tvAns.setVisibility(View.VISIBLE);
holder.ivArrow.setBackgroundResource(R.drawable.up_arrow);
flag = true;
}
else if (flag == true)
{
Logger.d("arrow clicked when flag is true");
holder.tvAns.setVisibility(View.GONE);
holder.ivArrow.setBackgroundResource(R.drawable.down_arrow);
flag = false;
}
notifyDataSetChanged();
}
});
return convertView;
}
static class ViewHolder {
TextView tvQuestion;
TextView tvAns;
Button ivArrow;
}
}
Can someone please tell what I am doing wrong here.
Thanks in Advance.
-Arindam.
public class ListAdapter extends BaseAdapter {
private Context context;
private List<String> mListQuestion = null;
private List<String> mListAnswer = null;
ViewHolder holder = null;
private List<Boolean> textViewVisibileState;
public ListAdapter(Context context, List<String> question, List<String> answer ) {
this.mListQuestion = question;
this.mListAnswer = answer;
this.context = context;
this.textViewVisibileState=new ArrayList<>(Arrays.asList(new Boolean[getCount()]));
Collections.fill(this.textViewVisibileState,false);
}
#Override
public Object getItem(int position)
{
return mListQuestion.get(position);
}
#Override
public long getItemId(int position) {
return position;
}
#Override
public int getCount() {
return mListQuestion.size();
}
#Override
#SuppressWarnings("deprecation")
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null)
{
LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = vi.inflate(R.layout.list_faq_item, null);
holder = new ViewHolder();
holder.tvQuestion = (TextView) convertView.findViewById(R.id.text);
holder.tvAns = (TextView) convertView.findViewById(R.id.anstext);
holder.ivArrow = (Button)convertView.findViewById(R.id.arrow_expand);
convertView.setTag(holder);
}
else
{
holder = (ViewHolder) convertView.getTag();
}
holder.tvQuestion.setText(mListQuestion.get(position));
holder.tvAns.setText(mListAnswer.get(position));
if(textViewVisibileState.get(position))
{
holder.tvAns.setVisibility(View.GONE);
holder.ivArrow.setBackgroundResource(R.drawable.down_arrow);
}
else
{
Logger.d("arrow clicked when flag is false");
holder.tvAns.setVisibility(View.VISIBLE);
holder.ivArrow.setBackgroundResource(R.drawable.up_arrow);
}
holder.ivArrow.setOnClickListener(new View.OnClickListener()
{
#Override
public void onClick(View v)
{
if (textViewVisibileState.get(position))
{
textViewVisibileState.set(position,false);
}
else
{
textViewVisibileState.set(position,true);
}
notifyDataSetChanged();
}
});
return convertView;
}
static class ViewHolder {
TextView tvQuestion;
TextView tvAns;
Button ivArrow;
}
}
This will work.
The variable flag is not context sensitive to object holder. So flag is always = false in your case. How about setVisibility(View.GONE) initially? And then setVisibility(View.VISIBLE) ONLY when ivArrow is clicked upon.
Calling notifyDataSetChanged() causes ListView to rebuild everything. It will remove its child views, call getView() for all the items that are visible, and thus you will rebind all the data for those items.
But your data hasn't actually changed. You haven't modified anything in the questions list, so binding the data again is meaningless. Instead you have tried to change something in your ViewHolder object, but there's no guarantee that the convertView you get after a notifyDataSetChanged() is for the same position as before, so it's possible that some other item has been affected (or perhaps none at all?).
Try removing the call to notifyDataSetChanged() from the OnClickListener. A visibility change should cause a re-layout of the view hierarchy, but as long as you haven't told ListView that the data has changed, it should keep all its current children.
Create an instance of the adapter, e.g Adapter myAdapter = new Adapter, set it to a listview or recyclerview e.g listview.setAdapter(mydapter) and everytime you add new data to it call adapter.notifyDataSetChanged()

ListView element change by clicking another element of same row

I have a ListView and a simple adapter class with two element. I just want to change one element by clciking the other one but whenever I scroll down or up the change is disappear. I have studied this two links
Why do items disappear when I scroll the listView?
Clickable element in custom ListView row
I know that listView has recycling feature which is the reason for this but I want a simple solution without refresh the whole list and when I will change on multiple rows, it should be there after getView called I mean after scroll up or down.
here is my adapter class code
public class Pha extends BaseAdapter {
private List<PhaMessages> pList = new ArrayList<PhaMessages>();
private Activity context;
ViewHolder viewHolder = null;
int fCounted = 0;
public Pha(Activity cont, ArrayList<PhaMessages> posts){
this.context = cont;
this.pList = posts;
Log.d("pha","called constructor..");
}
static class ViewHolder {
protected TextView fCount;
protected ImageView fIcon;
}
#Override
public int getCount() {
return pList.size();
}
#Override
public Object getItem(int position) {
return null;
}
#Override
public long getItemId(int position) {
return 0;
}
#Override
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflator = context.getLayoutInflater();
convertView = inflator.inflate(R.layout.pha_list_row, null);
viewHolder = new ViewHolder();
viewHolder.fIcon = (ImageView)convertView.findViewById(R.id.f_counter_img);
viewHolder.fCount = (TextView)convertView.findViewById(R.id.f_plus);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
final ViewHolder hold = viewHolder;
viewHolder.fCount.setText("" + pList.get(position).NumFrnd);
viewHolder.fIcon.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
if(!t){
fCounted++;
hold.fCount.setText(""+fCounted);
// by doing this at list I can see an immediate change that the number is changing
//
//but is i do viewHolder.fCount.setText(""+fCounted); I see another row changing
}else {
Toast.makeText(context,"You have already clcik this.",Toast.LENGTH_SHORT).show();
}
}
});
return convertView;
}
}
thanks in advance.
When you incrementfCounted value increment that value in your collection ie pListas well
in your getview method put position as tag in fCount component
viewHolder.fIcon.setTag(position); // this is to get exact position for which we will change/increment value
Now in fIcon's OnClickListener method
viewHolder.fIcon.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
if(!t){
fCounted++;
hold.fCount.setText(""+fCounted);
int position = (int)v.getTag();
int oldValue = pList.get(position).NumFrnd;
pList.get(position).NumFrnd = ++oldValue;
}
}
};

Android Muti Selected GridView Item

I want to select gridview item like gallery. First time i select using itemLongClickListenr then select only one time tap on other items that would be delete. Just like gallery image selection and then delete multiple images. How can i do this. Any Suggestion ? Thank you.
I had the similar task. I did as follows:
1-Create custom adapter.
2-implement item click listener and long item click listener.
3-on long item click listener, enable selection of items.
4-when selection is enabled, use item click listener to set property of selection of object to selected/unselected from data array.
5- upon delete button click, check your data array and remove items with selected property.
6-notify adapter about data changed.
That's all. here is code that I used, modify it to achieve your tasks.
public class FavoriteGVAdapter extends ArrayAdapter<FavoriteObject> {
Context context;
int layoutResourceId;
ArrayList<FavoriteObject> data = new ArrayList<FavoriteObject>();
boolean editable;
public FavoriteGVAdapter(Context context, int layoutResourceId,
ArrayList<FavoriteObject> data, boolean editable) {
super(context, layoutResourceId, data);
this.layoutResourceId = layoutResourceId;
this.context = context;
this.data = data;
this.editable=editable;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
Holder holder = null;
if (row == null) {
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
row = inflater.inflate(layoutResourceId, parent, false);
holder = new Holder();
holder.titleTV = (TextView) row.findViewById(R.id.titleTV);
holder.subtitleTV = (TextView) row.findViewById(R.id.subtitleTV);
holder.imageItem = (ImageView) row.findViewById(R.id.item_image);
holder.delete_btn = (Button) row.findViewById(R.id.delete_btn);
holder.edit_btn = (Button) row.findViewById(R.id.edit_btn);
row.setTag(holder);
row.setId(position);
} else {
holder = (Holder) row.getTag();
}
FavoriteObject item = data.get(position);
holder.titleTV.setText(item.getTitle());
holder.subtitleTV.setText(item.getPallets().size()+" Swatches");
try{
Drawable drawable = context.getResources().getDrawable(context.getResources()
.getIdentifier(item.getImageName(), "drawable", context.getPackageName()));
holder.imageItem.setImageDrawable(drawable);
}catch (Exception e){
holder.imageItem.setImageDrawable(null);
e.printStackTrace();
}
if (editable){
holder.edit_btn.setVisibility(View.VISIBLE);
holder.edit_btn.setOnClickListener(new OnEditItemClick(position));
}else {
holder.edit_btn.setVisibility(View.INVISIBLE);
row.setOnClickListener(new OnItemClick(position));
row.setOnLongClickListener(new OnLongClick(position));
}
return row;
}
static class Holder {
TextView titleTV,subtitleTV;
ImageView imageItem;
Button edit_btn,delete_btn;
}
private class OnLongClick implements View.OnLongClickListener {
private int mPosition;
OnLongClick(int position){
mPosition = position;
}
#Override
public boolean onLongClick(View v) {
v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
if (((Activity) context) instanceof FavoritesActivity) {
((FavoritesActivity) context).onFavoriteItemLongClick(mPosition);
}
return true;
}
};
private class OnItemClick implements View.OnClickListener {
private int mPosition;
OnItemClick(int position){
mPosition = position;
}
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (((Activity) context) instanceof FavoritesActivity) {
((FavoritesActivity) context).onFavoriteItemClick(mPosition);
}
}
};
private class OnEditItemClick implements View.OnClickListener {
private int mPosition;
OnEditItemClick(int position){
mPosition = position;
}
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (((Activity) context) instanceof FavoritesActivity) {
((FavoritesActivity) context).onFavoriteItemEditClick(mPosition);
}
}
};
}
In your activity use this:
public void onFavoriteItemClick(int mPosition)
{
if (editing){
gridArray.get(mPosition).selectItem(true);
CMAppManager.getInstance().saveFavoritesData(this, gridArray);
customGridAdapter.notifyDataSetChanged();
}
}
public void onFavoriteItemLongClick(int mPosition)
{
editing=true;
customGridAdapter = new FavoriteGVAdapter(this, R.layout.favorite_item, gridArray,(save_pallet)?false:true);
gridView.setAdapter(customGridAdapter);
}
Then on delete button click, remove the selected items from adapter array and notify adapter.

My ListView not working properly

I am getting one problem while adding ListView in layout. I have implemented one ListView in one page where we get list of items, in that when we click on some ListMember it change its color and again clicking on it will change it to previous color.Now imagine because of Item height one screen can hold maximum 5 List items,for next member to see you need to scroll down.
Now imagine List members are
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Among these use can only see 5 items at a time, now when I click on 'Item 1'(first member of first five members) its color is changing(say WHITE TO GREEN) but when I scroll down I see 'Item 6'(first member of first five members) is also changed its color(to GREEN),and when I click on 'Item 6' ,this time setOnItemClickListener for that member is getting actually triggered and trying changing its color to what it already changed.
this is code for setOnItemClickListener :
productList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> a, View v, int position, long id) {
Log.i("imIn","Item Clicked");
v.animate();
if(listClicked[position]==0)
{
Log.i("***After*** ","Cyan Set ON");
v.setBackgroundColor(Color.parseColor("GREEN"));
listClicked[position]=1;
}
else if(listClicked[position]==1){
Log.i("***After*** ","Cyan Set OFF");
v.setBackgroundColor(Color.parseColor("WHITE"));
listClicked[position]=0;
}
}
});
AfterEdit:: this is my adapter
public class ProductListBaseAdapter extends BaseAdapter {
SharedPreferences sharedpreferences;
private static ArrayList<Product> searchArrayList;
private LayoutInflater mInflater;
ArrayList<TotalSelectedProduct> selectedProducts=new ArrayList<>();
final int[] listClicked;
public ProductListBaseAdapter(Context context, ArrayList<Product> totalProducts, int[] ClickedList) {
searchArrayList =totalProducts;
mInflater = LayoutInflater.from(context);
listClicked=ClickedList;
}
public int getCount() {
return searchArrayList.size();
}
public Object getItem(int position) {
return searchArrayList.get(position);
}
public long getItemId(int position) {
return position;
}
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.item_list, null);
holder = new ViewHolder();
holder.txtItem = (TextView) convertView.findViewById(R.id.item_name);
holder.edit=(Button)convertView.findViewById(R.id.edit);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
/** I have tried inserting onClickListener in adapter also .but resulting same
*
holder.txtItem.setText(searchArrayList.get(position).getItemName());
final View.OnClickListener makeListener = new View.OnClickListener() {
#Override
public void onClick(View v) {
v.animate();
if(listClicked[position]==0)
{
Log.i("***After*** ","Cyan Set ON");
v.setBackgroundColor(Color.parseColor("#ff2dbeff"));
listClicked[position]=1;
}
else if(listClicked[position]==1){
Log.i("***After*** ","Cyan Set OFF");
v.setBackgroundColor(Color.parseColor("#009933"));
listClicked[position]=0;
}
}
};
holder.txtItem.setOnClickListener(makeListener); */
return convertView;
}
static class ViewHolder {
TextView txtItem;
Button edit;
}
}
Why this is happening ?
to do what you want, you have to add an adapter to your listview and there control the on click method for each item.
UPDATE WITH EXAMPLE
public class ProductAdapter extends ArrayAdapter<Product> {
public PProductAdapter(Activity activity,
ArrayList<Product> products) {
super(activity, R.layout.item_product, products);
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
final Product p = getItem(position);
ViewHolder viewHolder;
if (convertView == null) {
viewHolder = new ViewHolder();
LayoutInflater inflater = LayoutInflater.from(getContext());
convertView = inflater.inflate(R.layout.item_product, parent,
false);
viewHolder.name = (TextView) convertView.findViewById(R.id.tvName);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
convertView.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
p.checked = !p.checked;
if (p.checked)
v.setBackgroundColor(Color.parseColor("#ff2dbeff"));
else
v.setBackgroundColor(Color.parseColor("#009933"));
}
});
viewHolder.name.setText(p.name);
return convertView;
}
private class ViewHolder {
TextView name;
}
}
public class Product{
public String name;
public boolean checked;
Product() {
name = "dummy name";
checked = false;
}
}
Do as following
1 Handle click event in your adapter not Activity
2 View for your click can be parent layout in item_list.xml
3 Don't use final int[] listClicked instead have boolean variable in Product class for example isChecked.
4 Set and unset isChecked on click and set background color

Hide image from Activity to BaseAdapter

I want to hide image from ListView , Here i have used custom listview with BaseAdapter
Please see below image , Here on click of Edit btn Image 1 should be visible ,
ListView image is as follow
I have done this code from Activity on click of button
++btnClick;
if (btnClick % 2 == 0)
{
textView.setText("Edit");
baseAdapter.holder.imgPhoto.setVisibility(View.INVISIBLE);
} else {
textView.setText("Done");
Log.e("call", "Done");
baseAdapter.holder.imgPhoto.setVisibility(View.VISIBLE);
};
where baseAdapter is Object of BaseAdapter , Here what happens on click of button only last button Invisible as it is getting last reference , i don't want to reaload BaseAdapter again.
BaseAdapterFavotites.java
public class BaseAdapterFavotites extends BaseAdapter {
private ArrayList<SearchResults> searchArrayList;
public ArrayList<String> getSchoolId, getSchoolName;
private LayoutInflater mInflater;
public ViewHolder holder;
Context context;
public String s;
HashMap<String, String> mapSchoolToLink = new HashMap<String, String>();;
public BaseAdapterFavotites(Context context,
ArrayList<SearchResults> results, ArrayList<String> arrayId,
ArrayList<String> arraySchoolName) {
searchArrayList = results;
mInflater = LayoutInflater.from(context);
getSchoolId = arrayId;
this.context = context;
getSchoolName = arraySchoolName;
}
public int getCount() {
return searchArrayList.size();
}
public Object getItem(int position) {
return searchArrayList.get(position);
}
public long getItemId(int position) {
return position;
}
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = mInflater.inflate(R.layout.custom_row_for_favorites,
null);
holder = new ViewHolder();
holder.txtSchoolNameList = (TextView) convertView
.findViewById(R.id.schoolNameFav);
holder.imgPhoto = (ImageView) convertView.findViewById(R.id.delete);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.txtSchoolNameList.setText(searchArrayList.get(position)
.getschoolNameFromList());
Log.e("holder", searchArrayList.get(position).getschoolNameFromList());
holder.imgPhoto.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
mapSchoolToLink.clear();
searchArrayList.remove(position);
getSchoolId.remove(position);
getSchoolName.remove(position);
notifyDataSetChanged();
Log.e("inside base", searchArrayList.toString());
Log.e("inside getSchoolId", getSchoolId.toString());
for (int i = 0; i < getSchoolId.size(); i++) {
mapSchoolToLink.put(getSchoolName.get(i),
getSchoolId.get(i));
}
SharedPreferences.Editor editor = context
.getSharedPreferences("mytest", 0).edit().clear();
for (Entry<String, String> entry : mapSchoolToLink.entrySet()) {
editor.putString(entry.getKey(), entry.getValue());
}
editor.commit();
}
});
return convertView;
}
public class ViewHolder {
TextView txtSchoolNameList;
public ImageView imgPhoto;
}
}
i have to hide image from Activity to BaseAdapter any solution for this
You can setup a field variable in your Adapter, not your Activity, that controls whether the Images are visible or not, call it inEditMode. In getView() use your:
if(inEditMode) {
holder.imgPhoto.setVisibility(View.GONE);
}
else {
holder.imgPhoto.setVisibility(View.VISIBLE);
}
Whenever you toggle the state of inEditMode you must call notifyDatasetChanged() to update the entire ListView.
Addition
public View getView(final int position, View convertView, ViewGroup parent) {
// Recycling and View Holder code...
holder.txtSchoolNameList.setText(searchArrayList.get(position)
.getschoolNameFromList());
Log.e("holder", searchArrayList.get(position).getschoolNameFromList());
if(inEditMode) {
holder.imgPhoto.setVisibility(View.GONE);
}
else {
holder.imgPhoto.setVisibility(View.VISIBLE);
}
// Setting an OnClickListener that should happen in (convertView == null) { ... }
return convertView;
}
You can use flags to manage visibility and check flag value in getView in adapter. In both cases if(convertView==null) and else part also.
and on click of edit button set flag value to false and ListView.invalidate() or notifyDataSetChanged()

Categories

Resources