android-listview

Embed Listview into Preferences in Android

只谈情不闲聊 提交于 2019-12-08 04:41:20
问题 I need to show a list in Preferences view, so I created my own class (inherit of Preference ) and then set it like this: @Override protected View onCreateView(ViewGroup parent){ cards = new ArrayList<String>(); // Test cards.add("4859-2368957415"); cards.add("4859-5987412598"); LinearLayout layout = new LinearLayout(getContext()); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT); layout

Android - Multi Columns ListView

邮差的信 提交于 2019-12-08 04:40:58
问题 I have an ArrayList<myObject> and a ListView with a personal ArrayAdapter<myObject> using an inflated View that generates a list of Button s. It works, but one button per line is quite layout consuming ^^ I wanted to know if it was possible to display two or more items (Button) per line and how to do such a thing ? I thought about dividing my items in two lists (even and odd) but they'll have to scroll all-together for a better user experience... any idea ? or object that already implements

Update item height when modifying text size in ListView

只谈情不闲聊 提交于 2019-12-08 04:23:57
问题 I have a ListView with an ArrayAdapter which uses an XML layout, similar to simple_list_item_1, to inflate its content. I have two options in the app menu to increase/decrease the text size. I managed to modify the text size of the TextViews inside the ListView by overriding the getView function of the ArrayAdapter . Something like this: adapter = new ArrayAdapter<Line>(MyActivity.this, R.layout.line_list, lines){ @Override public View getView(int position, View convertView, ViewGroup parent)

How to run a function background in android?

丶灬走出姿态 提交于 2019-12-08 04:16:32
问题 In my application I have a function to populate listview.I want to run this function periodically on every 5 minutes.I have used following method for that. private class RefreshThread extends Thread{ public boolean isStop = false; public void run(){ try{ while(!isStop){ Headlines.this.runOnUiThread(new Runnable() { public void run() { populate_listview(); //Function to populate listview } }); try{ Thread.sleep(300000); } catch(Exception ex){} } }catch(Exception e){ } } } when I use this

Getting all checked items from listview Android

僤鯓⒐⒋嵵緔 提交于 2019-12-08 04:13:44
问题 I am a noobie at android programming , I am using Android studio and I have a listview item containing two textviews and a checkbox. I am trying to create a listiview with checkboxes so when a click on a specific button I will get a list the names of the checked items . Tried looking for tutorials and other helpful things but just can't get it right. Thank You everyone :) This is my custom adapter for the listview: public class postadapter extends ArrayAdapter<post> { ArrayList<post> list =

updating ListView from AsyncTask

倖福魔咒の 提交于 2019-12-08 03:52:58
问题 I have two classes,HomeActivity and CustomListAdapter.THe HomeActivity class extends an activity and then updates a listview.I am populating the data to the listview using a CustomListAdapter class which extends BaseAsapter.Everything is working fine but i want to load the data in a background task.When i do that,an error comes up. Here is my implementation of the onPostExecute of the AyncTask class. @Override protected void onPostExecute(HomeActivity Params){ progressDialog.dismiss();

How to show album art , song name ,duration, and the artist name in a ListView

倾然丶 夕夏残阳落幕 提交于 2019-12-08 03:51:28
问题 hello i wanna make an android music app for that i want my listView which shows all the songs to display album art of that song , artist name , duration and song name i have succeeded showing all the songs in the listview but unable to display album art etc so can anyone help me in this?? Thanks in advance 回答1: You can use content provider for this. Hope this code may help you to start up. final Cursor mCursor = getContentResolver().query( MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, new

Move to the next item - Android- Horizontallistview

情到浓时终转凉″ 提交于 2019-12-08 03:45:38
问题 The problem is that when I call from my ListView method performItemClick() I did not turn to the method setOnItemClickListener() , and get into a method getView () . I need to call a method setOnItemClickListener() which relate to my ListView , I tried to do this with listview.performItemClick () , but nothing happened . In fact , my problem is that I just have to go to my next item in the list (listview), but there is a problem , because I have a list of looped Integer.MAX_VALUE ; . Because

Android ListView with a checkbox

邮差的信 提交于 2019-12-08 03:30:50
问题 I've now spent a full day on trying to get a custom row to load. There seem to be plenty of examples here on StackOverflow and other places on how to bind a checkbox to a row of data within an Android listview, but they all seem to be incomplete. Here's what I have (row.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="40dip" android:orientation="horizontal" android

How to embed view of Fragment in the header of a ListFragment

余生长醉 提交于 2019-12-08 03:30:47
问题 I have a FragmentActivity where I'm dynamically adding Fragment s in my onCreate . I want a Fragment above a ListFragment . Of course, the first thing I tried was the fragments in one LinearLayout in one ScrollView , but then the ListFragment would only show one row at a time. I found Scrolling 2 fragment (one Fragment and one ListFragment) as one, but I don't know how to get the parent view of the Fragment to add to the header view of the ListFragment . I obviously get an NPE when call