android-listview

Fix JSONResponse on listview

和自甴很熟 提交于 2019-12-25 02:12:20
问题 I want to add row to listview from my JSON response. Here is the code from which I'm getting JSON and printing them in the cosole: HttpClient hClient = new DefaultHttpClient(); HttpGet hGet = new HttpGet( "APIHere"); ResponseHandler<String> rHandler = new BasicResponseHandler(); data = hClient.execute(hGet, rHandler); JSONObject rootObj = new JSONObject(data); JSONObject searchObj = rootObj.getJSONObject("searchdata"); JSONArray titlesObj = searchObj.getJSONArray("titles"); JSONArray descsObj

Android asynctask, prevent UI from freezing

[亡魂溺海] 提交于 2019-12-25 01:54:02
问题 I have this peace of code, that fetches some xml data from an url. It does it's job properly but the problem is that while it downloads and parses xml the UI freezes, and that might be a problem for the users. Here is the class @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.kategoria); // getting intent data Intent in = getIntent(); String cat_name = in.getStringExtra("kategoria"); //Update Textview TextView kategoriatw

Update and remove GridView items at runtime

为君一笑 提交于 2019-12-25 01:49:46
问题 i am developing a project where i compare the images of two items,So if two items will have same image after clicking these items should be hide. my code is given below and this code encounter a problem. is this a logical error or any other issue? i try to solve the issue but did't resolve.. Please guide me... here is my main Activity. MainActivity.java public class MainActivity extends Activity { Context ctx; int imagesArray[]; ImageAdapter adapter; List<Integer> pictures; boolean flage =

Filter on CustomArrayAdapter in Android

大憨熊 提交于 2019-12-25 01:44:35
问题 I'm new in Android, I followed some tutorials about adding search function on ListView, but in my case it's not working. Can anybody tell me what is wrong in my code. Here is my code: Activity.java public class SendMoney extends Activity { private ListView lvContacts; private EditText etSearch; private ContactListAdapter mAdapter; private String[] stockArr, stockArr1, stockArr2; private Intent i; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState)

Android - fragment with three listviews crashes with out of memory error

筅森魡賤 提交于 2019-12-25 01:17:33
问题 I've made this simple fragment layout - <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <ListView android:id="@+id/listView_airplanes" android:layout_width="170dp" android:layout_height="wrap_content" > </ListView> <ListView android:id="@+id/listView_fruits" android:layout_width="170dp" android:layout_height="wrap_content"

android: extending CheckedTextView source code

烈酒焚心 提交于 2019-12-25 01:16:34
问题 I was thinking of adding an icon to the items in a ListView who already has a text and a checkbox: simple_list_item_multiple_choice.xml which is nothing but a < CheckedTextView > tag with some attributes I'm aware of the custom adapter solution, but I really want and more intuitive solution. I know playing with the source code is not intuitive, but what I meant is the easiness of just doing this: SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, // context android.R.layout.simple

Adding to ListView

与世无争的帅哥 提交于 2019-12-25 00:18:55
问题 Im trying to add a list view to my activity. Here is what is suppose to happen: The user clicks on a button and that uses an asyncTask to get data from the internet. That data should then be added to the list view. The data comes from a table online therefore it there are 10 rows in the table then there should be 10 values in the Listview. But I'm having some problems. First of all can a listview be added to a pre-existing layout and be updated on the fly? Does a list view mean you cannot use

ListView with ViewPagers

删除回忆录丶 提交于 2019-12-25 00:18:27
问题 Im having trouble with my UI. It contains a ListView , with ViewPagers as List Items. The problem is that the horizontal scrolls seem to get interrupted by the ListView (catching vertical scrolls). What i want to achieve is that no matter what happens, the horizontal scrolls finish all the time. Right now they stop half way sometime. this is probably a common problem, but i havent found a solution yet. I've tried to intercept horizontal scrolls on the the listview, but although I can

ListView returning null using Fragment

会有一股神秘感。 提交于 2019-12-24 23:22:37
问题 When i try to retrieve the ListView coponent in XML layout, an NullPointerException is launched. ListView lv = (ListView) view.findViewById(R.id.lvAlerts); I'm using Fragments, any help is welcome. 1) Layout File (tab_frag_alerts.xml) <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <Spinner android:id="@+id/spinnerAlertCategory

android - identify items in a ListView

孤街浪徒 提交于 2019-12-24 23:19:50
问题 I'm having some troubles with correct identification of items in a ListView . There are 4 classes that matter, it's a lot of code so at first I'm going to explain the logic of those classes. Enter the ListActivity and initialize its ListView execute an AsyncTask that downloads JSON response from the server, parses it, populates the ListView with Objects and sets the adapter while showing a ProgressDialog the PlaylistItem class includes methods which simply get the data from a single