android-adapter

How to add an icon to a listview in a fragment

给你一囗甜甜゛ 提交于 2019-12-11 04:09:09
问题 I made a listview in a fragment. Now I need to add a simple icon to the listview items. The icon must be the same on every item. This will be a simple arrow (imageview). Is this possible with the listview I made? And if yes, how do I do it? So like this format: My text here --space--space-- > The code for the fragment: public class BiblioFragment extends Fragment { final String[] items = new String[] { "Astma en alcohol", "Astma en huisdieren", "Astma en lichaamsgewicht", "Astma en ouder

Wrong row deleted from custom listview with spinner

拥有回忆 提交于 2019-12-11 03:55:16
问题 I'm working on app that contains a custom ListView with a remove button that I update from the main activity. I have an issue removing a row from the ListView, although I'm deleting the right index from the custom list view and call notifyDataChanged() method, GUI does not update correctly. Here I wrote a sample project, like my real one in the idea just more sample: activity_main.xml (main layout) contains ListView only called listview. listview_row.xml contains two Spinners (student name

Updating ListView by notifydataSetChanged, has to use runOnUiThread?

依然范特西╮ 提交于 2019-12-11 03:52:41
问题 So i have this ListView, that uses my own custom arrayadapter. It works great, getting data from the database etc, but after its set there is no updating it. I have this activity that does something for result and when it comes back I call this: @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode==1899) { //a new client was added to the list... try { clients = (ArrayList<ClientsData>)

PagedListAdapter does not update list if just the content of an item changes

别等时光非礼了梦想. 提交于 2019-12-11 02:39:14
问题 I'm using the Room and Paging libraries to display categories. My Entity: @Entity(tableName = Database.Table.CATEGORIES) data class Category( @PrimaryKey(autoGenerate = true) @ColumnInfo(name = ID) var id: Long = 0, @ColumnInfo(name = NAME) var name: String = "", @ColumnInfo(name = ICON_ID) var iconId: Int = 0, @ColumnInfo(name = COLOR) @ColorInt var color: Int = DEFAULT_COLOR ) My DAO: @Query("SELECT * FROM $CATEGORIES") fun getPagedCategories(): DataSource.Factory<Int, Category> @Update fun

Recyclerview Position changing to first position when I Update

孤人 提交于 2019-12-11 00:18:10
问题 I am using onLoadMoreListener when i scroll RecyclerView . It will update the RecyclerView data when you scroll to bottom. After updating the Recyclerview data. The Recyclerview goes back up to the top. Ideally, I would like to retain the position in the RecyclerView . Any thoughts on how I should go about doing this? mAdapter.setOnLoadMoreListener(new OnLoadMoreListener() { @Override public void onLoadMore() { new GroupData().execute(); } }); InnerClass public static class GroupData extends

Android adapter not updating ui

我的未来我决定 提交于 2019-12-10 23:19:35
问题 I have a class witch holds some variables...eg int yellow = 0xffffff66; int green = 0xff00EE76; int red = 0xffff4342; int blue = 0xff42c3ff; int purple = 0xff9932CC; int white = 0xffffffff; ArrayList<Integer>nextColorArray = new ArrayList<Integer>(); int total_count = 0; in my onCreate method: GridView gridview2 = (GridView) findViewById(R.id.colorNext); gridview2.setAdapter(new ImageAdapter(this)); nextColorArray.add(blue); nextColorArray.add(green); nextColorArray.add(red); nextColorArray

IndexOutofBounexception in search adapter onbind method?

吃可爱长大的小学妹 提交于 2019-12-10 23:09:39
问题 I keep getting IndexOutofBoundsException from my onBind method in search adapter as soon as I start to search /filter my recyclerview list results. Here's the exception : java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 0(offset:0).state:25 android.support.v7.widget.RecyclerView{3247b3d VFED..... ......ID 0,0-1440,5550 #7f090216 app:id/search_guests_recycler_view}, adapter:com.myapp.ui.registervisitor.searchGuests.SearchGuestListAdapter@2433f32, layout

Cannot use finish() inside Adapter

旧时模样 提交于 2019-12-10 22:24:32
问题 I'm always getting this error when i'm setting the finish method inside adapter. 11-28 09:46:09.661 8636-8646/? E/art: Failed sending reply to debugger: Broken pipe 11-28 09:46:17.709 8636-8636/com.juandirection E/InputEventReceiver: Exception dispatching input event. 11-28 09:46:17.709 8636-8636/com.juandirection E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback 11-28 09:46:17.709 8636-8636/com.juandirection E/MessageQueue-JNI: java.lang.ClassCastException: com

Difference between setAdapter() and setDropDownViewResource() on Spinner

心已入冬 提交于 2019-12-10 22:22:43
问题 I looked at this question Difference between android.R.layout.simple_spinner_dropdown_item and android.R.layout.simple_spinner_item, but couldn't find an answer to my question. I can see that there is a difference between simple_spinner_item and simple_spinner_dropdown_item. But why do I need to set them both? Which part of Spinner layout is controlled by layout set in setAdapter() (simple_spinner_item ) and which one by layout set in setDropDownViewResource() (simple_spinner_dropdown_item) ?

How to use Espresso to test item in adapter at a specific position

社会主义新天地 提交于 2019-12-10 13:53:45
问题 I'm trying to use Espresso (2.0) to verify that the text in in a list adapter item at a given position is correct, and for the life of my I can't figure out the correct methods to call. My Adapter type ( IconRowAdapter ) contains a list of IconRow objects. Each IconRow has a getText() method that returns the text of that item. Here's the non-Espresso working test code that verifies that the IconRow object at position 0 in the adapter has the expected text ("Artists"). public void