Note that there are some explanatory texts on larger screens.

plurals
  1. POChange content of custom listView Android onclick?
    primarykey
    data
    text
    <p>I have custom listview where I am previewing the data i fetched from server. Now i want to change the data in the listview on its itemclick. The new data i want to preview also comes from the server. This is my BaseAdapter class</p> <pre><code> class MyCustomAdapter extends BaseAdapter { Vector&lt;String&gt; data_text; int[] data_image; MyCustomAdapter() { data_text = null; data_image = null; } MyCustomAdapter(Vector&lt;String&gt; text, int[] image) { data_text = text; data_image = image; } public int getCount() { return data_text.size(); } public String getItem(int position) { return null; } public long getItemId(int position) { return position; } public void updateResults( Vector&lt;String&gt; results) { data_text= results; //Triggers the list update notifyDataSetChanged(); } public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = getLayoutInflater(); View row; row = inflater.inflate(R.layout.category_list_element, parent, false); TextView textview = (TextView) row.findViewById(R.id.TextView01); ImageView imageview = (ImageView) row.findViewById(R.id.ImageView01); textview.setText(data_text.get(position).toString()); imageview.setImageResource(data_image[position]); return (row); }} </code></pre> <p>Please provide a solution.</p> <p>Please note i want to preview data on the same activity on the onclick of listview.</p> <p>And this is my onclick l1 is the listview</p> <pre><code> l1.setAdapter(new MyCustomAdapter(appCat, image)); l1.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view,int position,long id) { View curr = parent.getChildAt((int) id); TextView c = (TextView)curr.findViewById(R.id.TextView01); String sel_item = c.getText().toString(); API_GOD(URL); }}); </code></pre> <p>API_GOD(URL) is the server side data which is recieve. Now tell me how to update the list.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload