android-adapterview

Logcat error: “addView(View, LayoutParams) is not supported in AdapterView” in a ListView

自闭症网瘾萝莉.ら 提交于 2020-01-09 03:23:09
问题 I'm doing an application for Android and something I need is that it shows a list of all files and directories in the SD Card and it has to be able to move through the different directories. I found a good tutorial in anddev. I modified a few things so the application moves in the SD Card and not in Android root Directories but the rest is mostly the same. This is my xml file for the activity: <?xml version="1.0" encoding="utf-8"?> <ListView xmlns:android="http://schemas.android.com/apk/res

Auto-scrolling of AdapterView (Listview, GridView,…)

扶醉桌前 提交于 2020-01-02 05:00:12
问题 Background I'm trying to make an AdapterView (listview, gridview,...) to slowly auto scroll . the user can toggle it whenever he wishes, and it doesn't necessary move all the way to the end of the adapterView. again, i DO NOT wish to make the adapterView to scroll all the way to the bottom since the user should be able to cancel the auto-scrolling. What I've tried for this, i'm using the next code: private static final SCROLLING_RUNNABLE = new Runnable() { @Override public void run() { final

convertView loses onitemClick after the listView is scrolled

瘦欲@ 提交于 2019-12-30 07:14:22
问题 I'm having a slightly weird error here on my adapter. The view the adapter is creating is a thumbnail on the left side and a table with a few rows. Each row have two textviews. One of the textviews have the android:autoLink="web" property set and the listview have an onItemClickListener on it. the problem is that every time a TextView auto-links it's content, next time its parent view is converted, it doesn't receive clicks from the onItemClickListener anymore. Let me clarify with an example:

how to get object from listview in setOnItemClickListener in android?

爷,独闯天下 提交于 2019-12-29 05:07:19
问题 I have added arraylist in arrayadapter which contains objects each consists of two elements/items, I have successfully set that adapter for setListAdapter, now i want to get those items in setOnItemClickListener of listview. here is my code TweetListAdaptor adaptor = new TweetListAdaptor(this,R.layout.list_item, tweets); setListAdapter(adaptor); ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView

Espresso.onData set inAdapterView to be AlertDialog

試著忘記壹切 提交于 2019-12-25 09:22:25
问题 I have an AlertDialog that contains a list of options which is set: final AlertDialog.Builder builder = new AlertDialog.Builder(getContext()) .setTitle(args.getString(TITLE)) .setSingleChoiceItems(ARRAY_OF_CHARSEQUENCE, args.getInt(SELECTED_INDEX), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // handle click dismiss(); } }); I am trying to test clicking on each item. If I run: onView(allOf(withClassName(Matchers.equalTo

Updating views within a single row of a ListView when clicked

徘徊边缘 提交于 2019-12-25 09:21:26
问题 I was wondering how to update views/UI (say, making a TextView invisible) within a single row of a ListView when clicking on the row because every other rows' views would be affected as well. A good example would be playing a song in Google Play Music, and the equalizer animation would be displayed accordingly. Here are my snippets: MainActivity's onCreate(): @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity

ListView item duplicate on Scroll down

不羁岁月 提交于 2019-12-24 10:38:32
问题 I'm getting items duplicate on scroll down or switch to landscape mode, I've been reading some post about this subject before posting this new one, but the most of them explain the "else" catch on "if(converView == null)" which I already have on my code, but It anyways is getting duplicating. I'm going to give a simple example of what is my problem, I have a ListView on my "Payments" layout, as the name says, my ListView will show every payment I had register on my database. Basically I use a

How do you retrieve the array adapter currently set for a spinner? Android OS, Droid

巧了我就是萌 提交于 2019-12-24 02:19:14
问题 Looking to create a menu toggle that switches between two possible arrays for a spinner. For example, if the spinner is set to show array A, then when I press this menu button, I want the spinner to be set to array B. If I press it again, I want it to be set back to array A. I can handle the if/then statements and all, but how do I call the spinner's array adapter? I know how to call its value using getSelectedItemPosition(); but is there a similar method for retrieving WHICH array it is