Toast Item selected - AdapterView/ArrayList - java

I have created an Adapter arraylist that uses a LayoutInflater so images keep ratio. I am trying to perform a simple toast of the item title selected i.e "Beef".
Everthing workd as expected except I am getting an output from toast of, example
test com.sweatboxbbq.www.sweatboxbbq.Kansas City$MyAdaptor$Item#42aa9398
I know I am requesting a string value of and I'm getting it, but from the code, I can't figure out how to get what I want.
I want to capture the title only so I can toast it back (for now then aventually do something else).
Example items.add(new Item( beef, R.drawable.mine_beef)); I would get a string value of "beef"
Maybe I can id the title's of these array items somehow and pull them from there with the onclick method?
below is my Java code
public class KansasCity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.kansas_city);
final GridView gridView = (GridView) findViewById(R.id.meat_choice);
gridView.setAdapter(new MyAdapter(this));
//on click starts here
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
public void onItemClick(AdapterView<?> MyAdapter, View v, int position, long id)
{
String flavorPicked = "" +
String.valueOf(MyAdapter.getItemAtPosition(position));
Toast.makeText(KansasCity.this, "Test " + flavorPicked,
Toast.LENGTH_LONG).show();
}
});
}
//gridview
public class MyAdapter extends BaseAdapter {
public List<Item> items = new ArrayList<Item>();
private LayoutInflater inflater;
public MyAdapter(Context context) {
inflater = LayoutInflater.from(context);
items.add(new Item( "Beef", R.drawable.mine_beef));
items.add(new Item("Chicken", R.drawable.mine_chicken));
items.add(new Item("Swine", R.drawable.mine_pork));
items.add(new Item("Fish", R.drawable.mine_pork));
items.add(new Item("Turkey", R.drawable.mine_pork));
items.add(new Item("Sauce", R.drawable.mine_pork));
}
#Override
public int getCount() {
return items.size();
}
#Override
public Object getItem(int i) {
return items.get(i);
}
#Override
public long getItemId(int i) {
return items.get(i).drawableId;
}
#Override
public View getView(int i, View view, ViewGroup viewGroup) {
View v = view;
ImageView picture;
TextView name;
if (v == null) {
v = inflater.inflate(R.layout.gridview_item, viewGroup, false);
v.setTag(R.id.picture, v.findViewById(R.id.picture));
v.setTag(R.id.text, v.findViewById(R.id.text));
}
picture = (ImageView) v.getTag(R.id.picture);
name = (TextView) v.getTag(R.id.text);
Item item = (Item) getItem(i);
picture.setImageResource(item.drawableId);
name.setText(item.name);
return v;
}
private class Item {
final String name;
final int drawableId;
Item(String name, int drawableId) {
this.name = name;
this.drawableId = drawableId;
}
}
}
}
Thank you for any help.

you can either override toString() in your Item class and make it return the String you want to display, or make the member name of Item public, and use it like
String flavorPicked = ((Item)MyAdapter.getItemAtPosition(position)).name;

Please remove the " after flavorPicked
Toast.makeText(KansasCity.this, "Test " + flavorPicked",
Toast.LENGTH_LONG).show();

Related

How to delete listview item in fragment?

I'm trying to delete an item from a listview, but there is a problem..i'm using a fragment and I don't know how to get the "delete image button" to add a onClickListener...
That's my xml of the delete button which is in payment_list_view.xml :
<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/trash_icon"
android:padding="10dp"
android:id="#+id/delete_payment_btn"
android:background="#android:color/white" />
Then, I have my PaymentFragment which contains my listview:
package com.nicola.baccillieri.splitpayment;
public class PaymentFragment extends Fragment {
private String descString;
private int price;
private String payedBy;
private ArrayList<String> descPayArray;
private ArrayList<Integer> priceArray;
private ArrayList<String> payedByArray;
int trash;
PaymentAdapter customAdapter;
private final static String SHARED_PREFS = "sharedPrefs";
FirebaseFirestore db;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
db = FirebaseFirestore.getInstance();
trash = (R.drawable.trash_icon);
descPayArray = new ArrayList<>();
priceArray = new ArrayList<>();
payedByArray = new ArrayList<>();
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View rootView=inflater.inflate(R.layout.payments_fragment,container,false);
ProgressBar detailsPb = rootView.findViewById(R.id.details_pb);
detailsPb.getIndeterminateDrawable().setColorFilter(0XFF3F51B5,
PorterDuff.Mode.MULTIPLY);
detailsPb.setVisibility(View.VISIBLE);
final ListView listView = rootView.findViewById(R.id.paymentLv);
String email = getEmail();
String groupName = getActivity().getIntent().getStringExtra("title");
DocumentReference docRef = db.collection("users").document(email).collection("Group").document(groupName);
docRef.collection("Payments")
.get()
.addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
#Override
public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
for (QueryDocumentSnapshot document : queryDocumentSnapshots) {
//Extracting payment description from each document
descString = document.getId();
descPayArray.add(descString);
//Extracting cost and who payed from each document
price = document.getLong("cost").intValue();
priceArray.add(price);
payedBy = document.getString("payed by");
payedByArray.add(payedBy);
trash = R.drawable.trash_icon;
customAdapter = new PaymentAdapter(getActivity(), descPayArray, payedByArray, priceArray, trash);
listView.setAdapter(customAdapter);
ProgressBar detailsPb = rootView.findViewById(R.id.details_pb);
detailsPb.setVisibility(View.GONE);
// That's the line that cause the error
ImageButton deleteBtn = rootView.findViewById(R.id.delete_payment_btn);
deleteBtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
String groupName = getActivity().getIntent().getStringExtra("title");
int positionToRemove = (int) v.getTag();
String email = getEmail();
String paymentToRemove = descPayArray.get(positionToRemove);
DocumentReference docRef = db.collection("users").document(email).collection("Group").document(groupName).collection("Payments").document(paymentToRemove);
docRef.delete();
descPayArray.remove(positionToRemove);
customAdapter.notifyDataSetChanged();
}
});
}
// If there isn't any payment display a blank activity
ProgressBar detailsPb = rootView.findViewById(R.id.details_pb);
detailsPb.setVisibility(View.GONE);
}
})
.addOnFailureListener(new OnFailureListener() {
#Override
public void onFailure(#NonNull Exception e) {
ProgressBar detailsPb = rootView.findViewById(R.id.details_pb);
detailsPb.setVisibility(View.GONE);
Toast.makeText(getContext(), "Failed to load payments", Toast.LENGTH_LONG).show();
}
});
return rootView;
}
public String getEmail() {
SharedPreferences sharedPreferences = this.getActivity().getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
String email = (sharedPreferences.getString("email", ""));
return email;
}}
and finally the file group_detail_activity.xml contains my 2 fragment with a tab layout.
Now, the app crash when It has to show the PaymentFragment, because ImageButton deleteBtn = rootView.findViewById(R.id.delete_payment_btn); says
`java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageButton.setOnClickListener(android.view.View$OnClickListener)' on a null object reference".
That's because my rootView contains payment_fragment.xml, and not the payment_list_view.xml. So It doesn't find the button.
I've tryed to add final View rootListView=inflater.inflate(R.layout.payment_list_view,container,false);
and then it shows the list view, but when I click on the delete button, it doesn't do anything.
What should I do?
That's my PaymentAdapter:
package com.nicola.baccillieri.splitpayment;
public class PaymentAdapter extends BaseAdapter {
private Context context;
private ArrayList<String> payDesc;
private ArrayList<String> payedBy;
private ArrayList<Integer> price;
private int trash;
LayoutInflater inflater;
public PaymentAdapter(Context context, ArrayList<String> payDesc, ArrayList<String> payedBy, ArrayList<Integer> price, int trash) {
this.context = context;
this.payDesc = payDesc;
this.payedBy = payedBy;
this.price = price;
this.trash = trash;
inflater = (LayoutInflater.from(context));
}
#Override
public int getCount() {
return payDesc.size();
}
#Override
public Object getItem(int position) {
return payDesc.get(position);
}
#Override
public long getItemId(int position) {
return 0;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = inflater.inflate(R.layout.payment_list_view, null);
TextView paymentDesc = convertView.findViewById(R.id.payedDescTv);
TextView payedByTv = convertView.findViewById(R.id.payedByTv);
TextView priceTv = convertView.findViewById(R.id.priceTv);
ImageButton trashIcon = convertView.findViewById(R.id.delete_payment_btn);
paymentDesc.setText(payDesc.get(position));
payedByTv.setText("Payed by " + payedBy.get(position));
priceTv.setText(String.valueOf(price.get(position)) + "€");
trashIcon.setImageResource(trash);
trashIcon.setTag(position);
return convertView;
}}
The problem is that I need to delete the item both from the listview and from firebase...so I need the getEmail() method e the getExtra which is in PaymentFragment..If i put the listener on the adapter, how can I delete o Firebase?
Try this way. On list clicked you can delete item
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
payedByArray.remove(position);
adapter.notifyItemRemoved(position);
}
});
Other way is to put the Delete Button in your payment_list_view and then in Adapter you can get position on that button click and delete it
From Custom_adapater's viewholder get the view id , and you can easily delete the item by using
payedByArray.remove(position);
notifyItemRemoved(position);
notifyItemRangeChanged(position, payedByArray.size());
How to delete list item ,a SO's question already answered.. Have a look...
that might solve your problem.
You can set a listener to link the delete image button action to your fragment. Then can the button is click you trigger the listener and do what your want in your fragment. Yo can send the position to remove the good element
Your adapter don't know that list is being modified. you need to provide latest list to adapter after deletion of item.
Make your payedByArray list public in adapter code.
This activity code.
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
payedByArray.remove(position);
//payedByArray is activity list;
adapter.payedByArray = payedByArray;
adapter.notifyItemRemoved(position);
}
});

How to hide and unhide a specific ListView item on switch preference on off?

I want to hide the 2nd option from the list on switch on off, I know how switch works, just tell me how to hide-unhide the option from the list. I want to hide list view item by item position or something like that.
New query : Is it possible to add two different adapter and switch them on switch preference change? if yes then how to do that?
This is 100% possible.
String [] titles = {"abc","def","ghi"};
String [] descriptions = {"abc","def","ghi"};
int [] images = {R.drawable.ic_abc,R.drawable.ic_def,R.drawable.ic_ghi};
ListView lv;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_view);
lv = (ListView) findViewById(R.id.listView);
final Adapter adapter = new Adapter(getApplicationContext(), titles, descriptions, images);
lv.setAdapter(adapter);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
}
});
}
List view adapter
class Adapter extends ArrayAdapter {
int[] imageArray;
String[] titleArray;
String[] descriptionArray;
public Adapter(Context context, String[] titles1, String [] description1, int[] img1) {
super(context, R.layout.list_row, R.id.Titles, titles1);
this.imageArray = img1;
this.titleArray = titles1;
this.descriptionArray = description1;
}
#NonNull
#Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View row = inflater.inflate(R.layout.list_row,parent,false);
ImageView myImage = (ImageView) row.findViewById(R.id.Icons);
TextView myTitle = (TextView) row.findViewById(R.id.Titles);
TextView myDescription = (TextView) row.findViewById(R.id.Descriptions);
myImage.setImageResource(imageArray[position]);
myTitle.setText(titleArray[position]);
myDescription.setText(descriptionArray[position]);
return row;
}
}
Switch preference
public SwitchPreference sw;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_sw);
sw = (SwitchPreference) findPreference("001");
}
on switch on/off in main activity
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
boolean sw = sharedPreferences.getBoolean("001", true);
if (sw) {
//hide list view item (only one)
} else {
//unhide list view item (only one)
}
Well, take a look, so you can call remove properly:
class Adapter extends ArrayAdapter {
List<ItemObject> data = new ArrayList();
public Adapter(Context context, String[] titles1, String [] description1, int[] img1) {
super(context, R.layout.list_row, R.id.Titles, titles1);
for(int i = 0; i < titles1.lenght; i++)
data.add(new ItemObject(titles1[i], description1[i], img1[i]);
}
static class ItemObject {
String title, description;
int image;
ItemObject(String ti, String desc, int img) {
title = ti;
description = desc;
image = img;
}
}
//plus the rest of your class
And change at getView
ItemObject row = data.get(position);
myImage.setImageResource(row.image);
myTitle.setText(row.title);
myDescription.setText(row.description);
And add this method in the adapter:
public void removeObject(int at) {
data.remove(at);
notifyDataSetChanged();
}
So you can call removeObject with a position.

Arraylist reading the last element as the second last element

I have an Adapter Class that inflates items for a gridview. I am using an ArrayList to store certain details of the gridview item that is clicked. The problem that I am facing is that the last element is not recognised separately. If I click on the last element ,it is giving information about the element above it. Rest all other elements are fine.
public class MyAdaptertwo extends BaseAdapter
{
public List<Item> items = new ArrayList<Item>();
private LayoutInflater inflater;
int j;
public static List<list> rowitems = new ArrayList<list>();
static int size=0;
public MyAdaptertwo(Context context)
{
inflater = LayoutInflater.from(context);
items.add(new Item("S", R.drawable.s,"1",R.drawable.v));
items.add(new Item("F", R.drawable.t,"2",R.drawable.v));
}
#Override
public int getCount()
{
return items.size();
}
#Override
public Object getItem(int i)
{
j=i;
return items.get(i);
}
public void setCost(int i,String a)
{
items.get(i).cost=a;
}
#Override
public long getItemId(int i)
{
return items.get(i).colorId;
}
#Override
public View getView(int i, View view, ViewGroup viewGroup)
{
View v = view;
ImageView picture;
ImageView vn;
TextView name;
TextView costs;
if(v == null)
{
v = inflater.inflate(R.layout.gridview_item, viewGroup, false);
v.setTag(R.id.picture, v.findViewById(R.id.picture));
v.setTag(R.id.vnon, v.findViewById(R.id.vnon));
v.setTag(R.id.text, v.findViewById(R.id.text));
v.setTag(R.id.cost,v.findViewById(R.id.cost));
}
picture = (ImageView)v.getTag(R.id.picture);
vn = (ImageView)v.getTag(R.id.vnon);
name = (TextView)v.getTag(R.id.text);
costs = (TextView)v.getTag(R.id.cost);
Item item = (Item)getItem(i);
picture.setImageResource(item.colorId);
name.setText(item.name);
costs.setText(item.cost);
vn.setImageResource(item.vnId);
Button add=(Button)v.findViewById(R.id.add);
add.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v)
{
list item = new list(items.get(j - 1).colorId, items.get(j - 1).name, Integer.toString(co[j-1]), Integer.toString(no[j - 1]));
rowitems.add(item);
//something
}
});
Button sub=(Button)v.findViewById(R.id.sub);
sub.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v)
{
//something
}
});
return v;
}
private class Item
{
final String name;
final int colorId;
String cost;
final int vnId;
Item(String name, int drawableId,String cost,int vnId)
{
this.name = name;
this.colorId = drawableId;
this.cost=cost;
this.vnId=vnId;
}
}
}
Use setTag and getTag method of View class, To get click Item object in onClick method.
Item item = (Item)getItem(i);
Button add=(Button)v.findViewById(R.id.add);
add.setTag(i);
add.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
int position = (int)v.getTag();
//do something with item object
Item item = items.get(position);
list listItem = new list(item.colorId, item.name, Integer.toString(co[position]), Integer.toString(no[position]));
rowitems.add(listItem);
}
});

Android : Setting and getting clicked item id for a list containing text and images.

I am working on an Android project in which I have a list of items shown to the user along-with its images. The problem right now is because of the modifications I had to do to set the list, I don't know how I can change the code to include the id of the object which is being clicked by the user. I would not like the position, but the id which is received from the server. Any help would be nice. Thanks a lot. :-)
Please note, relevant code is more in the first class below, I have just put the LazyAdapter if there are modifications requried in it. Thanks a lot.
GroupCanvasActivity.java :
public class GroupCanvasActivity extends Activity {
private static volatile Long groupAccountid = (long) 0;
List<RestCanvas> restCanvasList = new ArrayList<>();
private CanvasServiceImpl canvasService = new CanvasServiceImpl();
LazyAdapter lazyAdapter;
ListView listView;
static final String mcanvasid = "canvasid";
static final String mcanvastitle = "canvastitle";
static final String mcanvasname = "mcanvasname";
static final String mcanvasimage = "mcanvasimage";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.canvaslayout);
Bundle extras = getIntent().getExtras();
if (extras != null) {
groupAccountid = extras.getLong("groupid");
}
restCanvasList = this.canvasService.getGroupCanvasForGroupAccount(groupAccountid);
ArrayList<HashMap<String, String>> canvaslist = new ArrayList<HashMap<String, String>>();
for (RestCanvas restCanvas : restCanvasList) {
HashMap<String, String> canvasDisplay = new HashMap<>();
// The below mcanvasid is what I would like to get when clicked
canvasDisplay.put("mcanvasid", String.valueOf(restCanvas.getMcanvasid()));
canvasDisplay.put("mcanvastitle", restCanvas.getMcanvastitle());
canvasDisplay.put("mcanvasname", restCanvas.getMcanvasname());
canvasDisplay.put("mcanvasimage", restCanvas.getMcanvasimage());
canvaslist.add(canvasDisplay);
}
listView = (ListView) findViewById(R.id.canlist);
lazyAdapter = new LazyAdapter(this, canvaslist);
listView.setAdapter(lazyAdapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// In the for loop above, you can see the mcanvasid, which I would like to use here.
}
});
}
}
LazyAdapter.java :
public class LazyAdapter extends BaseAdapter {
private Activity activity;
private ArrayList<HashMap<String, String>> data;
private static LayoutInflater inflater=null;
public LazyAdapter(Activity a, ArrayList<HashMap<String, String>> d) {
activity = a;
data=d;
inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public int getCount() {
return data.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
View vi=convertView;
if(convertView==null)
vi = inflater.inflate(R.layout.activity_group_canvas, null);
TextView canvasName = (TextView)vi.findViewById(R.id.canvasname); // id
TextView canvasTitle = (TextView)vi.findViewById(R.id.canvastitle); // title
ImageView canvasImage=(ImageView)vi.findViewById(R.id.canvasimage); // image
HashMap<String, String> canvasList = new HashMap<String, String>();
canvasList = data.get(position);
canvasName.setText(canvasList.get(GroupCanvasActivity.mcanvasid));
canvasTitle.setText(canvasList.get(GroupCanvasActivity.mcanvasname));
canvasImage.setImageBitmap(convertByteArrayToBitmap(canvasList.get(GroupCanvasActivity.mcanvasimage)));
return vi;
}
private Bitmap convertByteArrayToBitmap(String string){
byte [] encodeByte= Base64.decode(string, Base64.DEFAULT);
return BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length);
}
}
Any help would be nice. Thank you. :-)
Do like this :
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
String mcanvasid = restCanvasList.get(position).get("mcanvasid"); // Here you get the mcanvasid
}
});
try this. In your adapter:
public Object getItem(int position) {
return d.get(position);
}
, in your activity:
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
String output = (HashMap<String, String>)(parent.getAdapter.getItem(position)).get("mcanvasid");
//do what you want with output
}
});

Android Refresh ListActivity from BaseAdapter

I have a ListActivity and a custom adapter that extends BaseAdapter.
On each row of the ListView, there is a button and a few more views. onClickListener is declared in the adapter.
How can I refresh list view after button is clicked ?
Here is the code
List Activity:
.........
super.onCreate(savedInstanceState);
here im reading content from a file and then creating adapter with that content
adapter = new UvArrayAdapter(this, strarray3, strarray2, intarray);
setListAdapter(adapter);
..........
Adapter:
.......
public class UvArrayAdapter extends BaseAdapter {
private Context mContext;
private LayoutInflater linflater;
private TextView txt_1, txt_2, txt_3;
private ProgressBar pr1;
private String[] str1;
private String[] str2;
private String[] str3;
private Integer[] int1;
private class OnItemClickListener implements OnClickListener{
private int mPosition;
OnItemClickListener(int position){
mPosition = position;
}
#Override
public void onClick(View arg0) {
Log.v("TAG", "onItemClick at position" + mPosition);
}
}
public UvArrayAdapter(Context context, String[] s1, String[] s2, Integer[] i1) {
mContext = context;
str1 = s1;
str2 = s2;
int1 = i1;
linflater = LayoutInflater.from(context);
}
#Override
public int getCount() {
return str1.length;
}
#Override
public Object getItem(int arg0) {
return str1[arg0];
}
#Override
public long getItemId(int arg0) {
return arg0;
}
#Override
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = linflater.inflate(R.layout.uv_rowlayout, null);
}
convertView.setOnClickListener(new OnItemClickListener(position));
txt_1 = (TextView) convertView.findViewById(R.id.textView1);
pr1 = (ProgressBar) convertView.findViewById(R.id.progressBar1);
pr1.setProgress(int1[position]);
txt_1.setText(str1[position]);
txt_2 = (TextView) convertView.findViewById(R.id.textView2);
txt_2.setText(str2[position]+"mV");
Button btn = (Button) convertView.findViewById(R.id.button1);
btn.setOnClickListener(new OnClickListener(){
#Override
public void onClick(View v) {
Log.v("onClickListener", "button - clicked at position " position);
do some changes in mentioned file and after that i need to update the list view with new data
}});
return convertView;
}
}
adapter.notifyDataSetChanged(); // to notify the adapter that your data has been updated
Note: If you get any errors with the above line, you could try the following code (where mListView is the name of my ListView object)
((BaseAdapter) mListView.getAdapter()).notifyDataSetChanged();
Another way would be to invalidate the List so that it is redrawn form the updated data set once again.
mListView=(ListView) findViewById(R.id.MyListView);
mListView.invalidate();
Use notifyDataSetChanged()
adapter = new UvArrayAdapter(this, strarray3, strarray2, intarray);
setListAdapter(adapter);
UvArrayAdapter.notifyDataSetChanged();
// To make the adapter aware of the changes

Categories

Resources