android-adapter

android.widget.RelativeLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams

折月煮酒 提交于 2019-12-10 03:36:24
问题 Following numerous tutorials and example projects I've arrived at the following code which should fill a ListView with rows that contain multiple values out of a Line object. Being a newbie programmer I cannot for the life of me figure out where the hell my code fails. Any help would be much appreciated! If I left out important information please tell me and I will update this question. The code that starts it all inside the Fragment: @Override public void onActivityCreated(Bundle

Android - update listview after AsyncTask

泪湿孤枕 提交于 2019-12-10 00:28:41
问题 I apologize for my English but translated with google. I need help for my application, I'm using a ExpandableListView with 3 different groups, 2 groups with static items and a group with items that it should to update after a AsyncTask . When I run the application the first time, the group with dynamic items is empty , instead the second time is visible . How I do to update in real time dynamic items? My application is structured in this way, I have a main activity that instantiates the

Android: visible ListView images flicker when adding data to ArrayAdapter

久未见 提交于 2019-12-09 16:02:11
问题 I have a custom adapter which extends ArrayAdapter, it implements the view holder patterns to show data (text + image) from a web service. for lazy loading of the images I use the async tasks pattern from the advanced training in the Android's developers site, I also use disk + ram bitmap cache. when there is additional data to be retrieved I add a footer view that clicking on it retrieves additional data from the web service and add it to the adapter. the problem is that when this new data

RecyclerView.Adapter.notifyItemMoved(0,1) scrolls screen

Deadly 提交于 2019-12-08 22:25:59
问题 I have a RecyclerView managed by a LinearlayoutManager, if I swap item 1 with 0 and then call mAdapter.notifyItemMoved(0,1), the moving animation causes the screen to scroll. How can I prevent it? 回答1: Call scrollToPosition(0) after moving items. Unfortunately, i assume, LinearLayoutManager tries to keep first item stable, which moves so it moves the list with it. 回答2: Sadly the workaround presented by yigit scrolls the RecyclerView to the top. This is the best workaround I found till now: //

how to delete data from AutoCompleteTextView with adapter directly

余生颓废 提交于 2019-12-08 19:10:40
I have AutoCompleteTextView which uses to search the value from database. On Click of filtered value it's set to the AutoCompleteTextView which can be use to update the value for the particular data. I would like to incorporate delete ImageView functionallity next to filtered item. On Click of it Alert Dialog whether to delete or not. Been able to develop the scenario. MyCursorAdapter adapter = new MyCursorAdapter(this, R.layout.edt_delete_item, null, fromName, to); searchText.setAdapter(adapter); adapter.setCursorToStringConverter(new CursorToStringConverter() { @Override public String

RecyclerView - How highlight central visible item during scroll

纵然是瞬间 提交于 2019-12-08 15:49:46
问题 I need a RecyclerView like this: It should does: show 7 items per time ( DONE ) center the RecyclerView on the central visible item ( DONE ) when I scroll to right/left, the central item will be "highlighted" (the button is selected > blue color) ( need HELP ) when I click on a button, it will be centered with a smooth scrool ( need HELP ) I used SnapHelper class to center the RecyclerView on the central items (I retrieve the central visible item getting the nearest child to the screen center

Converting an Integer to a Drawable

亡梦爱人 提交于 2019-12-08 14:20:31
问题 I have two Adapter classes and in the first one, i have an Array of Integers[] named mThumbIds which is initialized like this : // References to our images private Integer[] mThumbIds = { R.mipmap.beyondthe_ferocious_flash_majin_vegeta_icon, R.mipmap.full_tilt_kamehameha_super_saiyan2_gohan_youth_icon, R.mipmap.merciless_condemnation_goku_black_super_saiyan_rose_and_zamasu_icon, R.mipmap.everlasting_legend_super_saiyan_goku_icon, R.mipmap.indestructible_saiyan_evil_legendary_super_saiyan

Out Of memory error while using LazyList in ListView [duplicate]

旧城冷巷雨未停 提交于 2019-12-08 13:48:36
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Out Of memory error using Universal Image Loader and images getting refreshed I have been following the Tutorials on lazy loading the images in a list view and than I implemented LazyList . The code is working properly as per my requirements however it is giving Out Of Memory Errors at some stages. I am using the same code of ImageLoader, Memory cache, LazyAdapter, FileChache and Utils. Here is LazyAdapter class

Using buttons in Listview row android

天大地大妈咪最大 提交于 2019-12-08 13:29:37
问题 In my android application, I am using Listview and each row of listview will have textview and play/pause button. Here I am displaying audio file in each list row.When user click play button, audio file will start and the icon of play button will be changed to pause .If i click same button again, it will stop that audio file and icon of pause button will be to play. The problem is that if i am accessing the play button of 1st row and i click on play button of another row, then icon of 1st row

Passing data on click in RecyclerView.Adapter

我是研究僧i 提交于 2019-12-08 13:29:05
问题 I have a RecyclerView on my fragment that shows certain files i've loaded from an FTP Server. I'm trying to set an onClickListener for each item, so when it will be clicked, a DialogFragment will be shown, in which the user will be able to choose whether to download or open the file. My problem is: I need to send to my dialog 2 things: The target fragment, which will download/open the file after the user chooses what to do. This can be easily dont with setTargetFragment() , the only problem