listview-adapter

Android - My Simple ListView/Toast app crashes on startup… any ideas?

試著忘記壹切 提交于 2020-01-06 01:55:16
问题 I am creating a simple ListView app to learn more about programming for android. However, this simple code (which is showing no errors whatsoever in Eclipse) is simply crashing on startup in the emulator. Any ideas? public class MainActivity extends Activity { static final String[] FRUITS = { "Apple", "Avocado", "Banana", "Blueberry", "Coconut", "Durian", "Guava", "Kiwifruit", "Jackfruit", "Mango", "Olive", "Pear", "Sugar-apple" }; protected void onCreate(Bundle savedInstanceState) { super

Custom listview on AlertDialog multichoice

江枫思渺然 提交于 2020-01-02 11:15:34
问题 I would like to create AlertDialog same as on the picture: My code: adapter_book_desc.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:gravity="center_vertical" android:paddingLeft="15dip" android:layout_width="match_parent" android:layout_height="match_parent" > <CheckedTextView android:textAppearance="?android:attr/textAppearanceLarge" android:id="@+id/text1" android:layout

Custom listview on AlertDialog multichoice

亡梦爱人 提交于 2020-01-02 11:15:05
问题 I would like to create AlertDialog same as on the picture: My code: adapter_book_desc.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:gravity="center_vertical" android:paddingLeft="15dip" android:layout_width="match_parent" android:layout_height="match_parent" > <CheckedTextView android:textAppearance="?android:attr/textAppearanceLarge" android:id="@+id/text1" android:layout

Android change ListView font

。_饼干妹妹 提交于 2020-01-02 07:56:11
问题 Seems to be a simple question, but since I am new to Android development I have very little idea about Android ListViews. Following is the code I have used for a ListView in my project. /*Listview code starts*/ mainListView = (ListView) findViewById( R.id.mainListView ); ArrayList<String> planetList = new ArrayList<String>(); planetList.addAll( Arrays.asList(values) ); listAdapter = new ArrayAdapter<String>(this, R.layout.list1, values); mainListView.setAdapter(listAdapter); mainListView

ListView + ImageButton + descendantFocusability

安稳与你 提交于 2019-12-29 10:05:43
问题 I have a listview to which I add rows with 1 imagebutton .. I tried to set the imagebutton the setfocusable false but still not working .. item_list.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="160dp" android:descendantFocusability="blocksDescendants" android:id="@+id/RL_item"> <ImageButton android:layout_width="200dp" android:layout_height="fill_parent" android

ListView + ImageButton + descendantFocusability

半世苍凉 提交于 2019-12-29 10:03:30
问题 I have a listview to which I add rows with 1 imagebutton .. I tried to set the imagebutton the setfocusable false but still not working .. item_list.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="160dp" android:descendantFocusability="blocksDescendants" android:id="@+id/RL_item"> <ImageButton android:layout_width="200dp" android:layout_height="fill_parent" android

how to update the textview text depending on the state of a checkbox in listview

和自甴很熟 提交于 2019-12-29 07:22:11
问题 Here is My Custom ListViewAdapter public class ListViewAdapter extends BaseAdapter{ Viewholder holder; public ArrayList<HashMap<?, ?>>list; public ArrayList<Integer> add; Activity activity; boolean [] checkedItems; String []ckboxTextAdd; DbAdapter db; /* * Constructor Calling */ public ListViewAdapter(Activity activity,ArrayList<HashMap<? , ?>>list) { // TODO Auto-generated constructor stub super(); this.activity=activity; this.list=list; add=new ArrayList<Integer>(list.size()); db=new

Update Android Listview after Asynchronous update

雨燕双飞 提交于 2019-12-24 06:19:22
问题 I am converting my HTTP calls to asynchronous calls from synchronous ones. Because the connection is running in the background the data isn't there when I originally set my list adaptor. How can I get the list adaptor to update after my HTTP call? I've tried a few things like not setting the adaptor until data gets sent back and setting the adaptor again, but nothing has worked. Here's my current oncreate code protected void onCreate(Bundle savedInstanceState) { overridePendingTransition(R

How do I add an OnClickListener to a button inside a ListView adapter?

主宰稳场 提交于 2019-12-17 10:48:38
问题 I have a listview that contains the list of all my users. Every item from the list is a layout that has a button to show an AlertDialog to change the value of the label of the button. How can I dynamically add an on click event to that button that is generated by the listview Adapter? This is my adapter: public class PerfilAdapter extends BaseAdapter { Context mContext; LayoutInflater mLayoutInflater; List<PerfilBean> listaPerfiles = new ArrayList<PerfilBean>(); public Settings01 set=new

ListView adapter with many checkboxes

只愿长相守 提交于 2019-12-13 04:18:23
问题 I'm having some minor problems with my listview. Every item has some information and a checkbox. This shows up fine, I can select and deselect checkboxes etc etc. However I discovered some strange behaviour. Lets say I click the first checkbox at the first row. If the ListView is small so you don't need to scroll down this works fine. But if the ListView is large so I need to scroll down to see all the items, some random item at the bottom also becomes clicked. Same behaviour the other way