android-listview

ListActivity doesn't update as data arrives

百般思念 提交于 2019-12-05 16:54:47
I'm building a small application that I'd like to automatically update when new data arrives. From what I've read of the android documentation, I thought that because I'm using the newer techniques that a ContentObserver would be created in the background for me, and I would just get automatic calls to the Loader. If there's any more information that would be helpful, I'd be glad to add it, or to upload the complete project somewhere. Additionally, I'm targeting KitKat (sdk version 19). Application Overview We have a ListActivity using the builtin ListView. The ListActivity gets data by using

Get ListView Height after setadapter

此生再无相见时 提交于 2019-12-05 15:55:54
well, I'm trying to get my listview height after I change it data, but it always return the prior height, not the actual. So when I set the setadapter, and it get the old value. e.g: ActualHeight = 100 Change data (filter) -> NewHeight = 60 ListView.GetHeight still returns 100. Again ActualHeight = 60 Change data (filter) -> NewHeight = 20 ListView.GetHeight still returns 60. The code i'm using is it: int width, height = 0; EditText edt_search; ListView lv_marca; List<Marca> list_marca = new ArrayList<Marca>(); List<Marca> list_marca_search = new ArrayList<Marca>(); String text = edt_search

How to save state of Fragment having listview

左心房为你撑大大i 提交于 2019-12-05 15:00:50
问题 Here is a situation. I want to navigate from Fragment A-> B-> C. In B Fragment there is listview. On item click I open the detail view C Fragment. Ofcourse I used replace method and added addtoBackStack(null) while transactiong from B to C so that on Back press it returned to B. All goes well. But when I return to B from C, the view is being refreshed and hence the webservice is being called again. I don't want to do this. I want to retain the B Fragment state with listview. I got some post

android ListView won't highlight selected row

梦想的初衷 提交于 2019-12-05 14:56:30
In my app I retrieve a user's playlist from the server and feel a ListView with the data. The problem is, that the ListView does not highlight clicked rows. To prevent rage comments telling me that I don't use search here are things I've tried: setting the button in my row to non-focusable setting the listSelector both by code and XML (not at the same time) trying to change the background of passed View in an OnItemClickListener using setItemsCanFocus() with bot true and false parameters setting an XML drawable with states "selected" and "pressed" to row layout root Clicks are detected since I

Expandable list view setOnChildClickListener not working

爷,独闯天下 提交于 2019-12-05 13:59:04
问题 I m using an expandable listview. i given setOnChildClickListener inside the onceate method, but the setOnChildClickListener is not working, i was searching for the solution in SO but i cannot find any solution. here giving what i had done public class MenuActivity extends Activity{ ArrayList<MyObject> CatList = new ArrayList<MyObject>(); ArrayList<Object> childItem = new ArrayList<Object>(); ExpandableListView ExList; @Override protected void onCreate(Bundle savedInstanceState) { super

how to add mapfragment inside a listview item within adapter?

一世执手 提交于 2019-12-05 13:31:25
I have a list view. I want to add a map inside each list item. The map will show/hide when I click on the list item. When the map shows, I can zoom, view location detail... on it. But I can't set MapFragment in the adapter. So, give me some solutions. Thank you. gMap = (MapFragment) getFragmentManager().findFragmentById(R.id.map); googleMap = gMap.getMap(); I can't do that in getView. I just went through a similar problem and I came up with the following solution. By the way, now play services has google map lite mode. You can see the entire example at: https://github.com/vinirll/MapListView

Android: Display image in imageview by SimpleAdapter

余生颓废 提交于 2019-12-05 13:30:43
I am new android now I want to display image from an url. I am using imageview in listview. I want to add the list of images into the each row of the list item. I used SimpleAdapter but the imageview shows blank. Here's the main activity: package com.example.mysqltest; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.ListActivity; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import

How to expand and collapse an item in listview

老子叫甜甜 提交于 2019-12-05 13:00:18
I am pretty new to android. I want to implement a list view. It contains some list items and when they are clicked, they should expand showing more information. But I unable to find a way to do that Here is my activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <ListView android:id="@+id/listview1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:clickable="True"

Show divider after the last item in the list

亡梦爱人 提交于 2019-12-05 12:37:13
I added a divider drawable to my listview but it appears for all the items except after the last item. I only have 5 items on the list, so its all white space after the last item, i want to have a divider even after the last item i tried this: android:footerDividersEnabled="true" in my listview. But it didnt work Thank You Try following in XML <View android:background="#00ff00" android:layout_width="fill_parent" android:layout_height="3dp" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_below="@+id/YOUR_LIST_ID" /> Horizontal line <View android:id="@

how to setOnclickListener() on the Button inside the ListView?

﹥>﹥吖頭↗ 提交于 2019-12-05 11:33:31
In app I have a Listactivity which has an adapter with TextView and Button(labeled delete). Now I want to remove corresponding Button clicked item. please check the code and suggest???? ` public class MySimpleArrayAdapter extends ArrayAdapter<String> implements OnClickListener { private final Activity context; private final String[] names; private Button deleteButton= null; public MySimpleArrayAdapter(Activity context, String[] names) { super (context, R.layout.imagelistlayout, names); this.context = context; this.names = names; } @Override public View getView(int position, View convertView,