adapter

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

泪湿孤枕 提交于 2019-11-27 07:57:44
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/android" android:id="@id/android:list" android:layout_width="fill_parent" android:layout_height="fill

Difference between the Facade, Proxy, Adapter and Decorator design patterns? [closed]

旧街凉风 提交于 2019-11-27 04:55:32
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . What is the difference between the Facade, Proxy, Adapter, and Decorator design patterns? I have never read a clear explanation, what's yours? 回答1: Adapter adapts a given class/object to a new interface. In the case of the former, multiple inheritance is typically employed. In the

android attaching multiple adapters to one adapter

吃可爱长大的小学妹 提交于 2019-11-27 04:43:30
I have been using the SeparatedListAdapter which is very well known and works perfectly, but it seems that I cannot use the addSection() to add a SimpleAdapter, because the application is terminated. I'm providing some code to show you what I'm trying to do and get some guidance in order solve this issue. Please let me know if you need any other piece of code or anything: // Declarations private SimpleAdapter _resultsAdapter; private ArrayAdapter<String> _adapter; private List<Map<String,?>> _resultsList; private ArrayList<String> _stringList = new ArrayList<String>(); // Much of source code

Using Cursor with ListView adapter for a large amount of data

蹲街弑〆低调 提交于 2019-11-27 04:31:40
问题 i am using a custom CursorAdapter to get data from a SQLite database and show it in a listview. The database contains a 2 columns with about 8.000 rows. so i am looking for a way to query and show all the data as fast as possible. i have done this with asyncTask here is the code: private class PrepareAdapter extends AsyncTask<Void,Void,CustomCursorAdapter > { @Override protected void onPreExecute() { dialog.setMessage("Wait"); dialog.setIndeterminate(true); dialog.setCancelable(false); dialog

What is the intent of the methods getItem and getItemId in the Android class BaseAdapter?

不问归期 提交于 2019-11-27 03:57:22
问题 I'm curious about the purpose of the methods getItem and getItemId in the class Adapter in the Android SDK. From the description, it seems that getItem should return the underlying data. So, if I have an array of names ["cat","dog","red"] and I create an adapter a using that, then a.getItem(1) should return "dog", correct? What should a.getItemId(1) return? If you've made use of these methods in practice, could you provide an example? 回答1: I see these methods as a cleaner approach to

custom checkbox difficulty in android

一曲冷凌霜 提交于 2019-11-27 03:49:38
问题 how to modify this imageCheckBoxAdapter code in order to maintain status of checkBox when scrolled(that is all the checkboxes which are checked should remain checked even after scrolling. Also the checked variables need to be stored in an array)? class imageCheckBoxAdapter extends ArrayAdapter<String> { private final Context context; private final ArrayList<String> values; private final Map< String, SmbFile> obj; static ArrayList<Boolean> checks=new ArrayList<Boolean>(); public

Efficient parametrization of multi-domain deep neural networks阅读笔记

孤者浪人 提交于 2019-11-27 03:45:13
常见的迁移学习任务 1、multi-task model 同时适用于多个task 2、multi-domain model 同时适用于多个domain 3、extensible model 模型可随时间进化,通过之前学习的知识来迁移到新的 任务 和 domain 上 创新 定义网络为 ; w 是universal vector,固定且不同domain之间共享; α 是parameter vector,为domain specific参数。其中, α 要远小于 w 。 结论 1、parallel adapter 优于 series adapter 2、early + late layers都需要adapted 3、dropout对bigger pretrained network有较大提升 来源: https://blog.csdn.net/sinat_30618203/article/details/99336511

Deserializing ImmutableList using Gson

笑着哭i 提交于 2019-11-27 03:20:32
问题 I'm using quite a few immutable collections and I'm curious how to deserialize them using Gson. As nobody answered and I've found the solution myself, I'm simplifying the question and presenting my own answer. I had two problems: How to write a single Deserializer working for all ImmutableList<XXX> ? How to register it for all ImmutableList<XXX> ? 回答1: Update: There's https://github.com/acebaggins/gson-serializers which covers many guava collections: ImmutableList ImmutableSet

ListView adapter data change without ListView being notified

纵饮孤独 提交于 2019-11-27 02:55:39
问题 I've written a ListActivity that has a custom list adapter. The list is being updated from a ContentProvider when onCreate is run. I also have a service that gets started when I run the app and it first updates the ContentProvider, then sends a Broadcast that the content has been updated. My ListActivity receives the broadcast and tries to update my ListView. My problem is, I'm getting intermittent errors about the ListView adapter data changing without the ListView being notified. I call the

ViewPager + FragmentStatePagerAdapter + orientation change

邮差的信 提交于 2019-11-27 02:52:40
问题 I have a little Problem: i have a ViewPager with some Pages and i use the FragmentStatePagerAdapter to handle the data. In portrait i have for example 20 pages for the ViewPager and in landscape i have just 10 pages for the ViewPager. So on a orientation change i create a new Adapter with different Data. Here a little explanation why: I show one image in portrait and two in landscape but always all in count. If i have 10 pictures to show, i have 10 in portrait and 5 in landscape (always two).