adapter

notifyDataSetChanged not working

∥☆過路亽.° 提交于 2019-11-28 00:35:16
问题 My app uses a MultiColumnListView (https://github.com/huewu/PinterestLikeAdapterView) and as its name says it helps creating multi column list views. The library is great, but as they specify, filtering is not supported. So I am trying to create my own text-filter functionality with a simple edit text. Finally I achieve to filter the list but now I need to refresh the listView and recall the setAdapter because I pass the list on it. MyAdapter adapter = new MyAdapter(this,myList); listView

Cursor and Adapter

六月ゝ 毕业季﹏ 提交于 2019-11-28 00:28:25
can someone see what I have wrong with my cursor: The data from the db is not returned (at least the screen is blank). I think that is my problem. In the DDMS shows it opens & closes the db. I am not sure what 'Cursor databaseCursor = null;' needs to be. Thnx!! The Activity: private void displayResultList() { Cursor databaseCursor = null; DomainAdapter databaseListAdapter = new DomainAdapter(this, R.layout.list_item, databaseCursor, new String[] { "label", "title", "description" }, new int[] { R.id.label, R.id.listTitle, R.id.caption }); databaseListAdapter.notifyDataSetChanged(); this

Android数据存储操作④Adapter之ArrayAdapter、SimpleAdapter

北城余情 提交于 2019-11-28 00:26:17
Adapter在Android中占据一个重要的角色,它是数据和UI(View)之间一个重要的纽带。在常见的View(ListView GridView Gallery Spinner)等地方都需要用到Adapter。 一、ArrayAdapter: BaseAdapter的具体实现,在实例化时可以使用泛型结构,ArrayAdapter 负责把一个字符串数组中的数据填充到一个View当中。 1 // 首先声明一个Spinner类的对象 2 Spinner s = (Spinner)findViewById(R.id.flipper); 3 // 之后调用ArrayAdapter 4 ArrayAdapter < String > adapter = new ArrayAdapter < String > ( this ,android.R.layout.simple_spinner_item,mStrings); 5 android.widget.ArrayAdapter.ArrayAdapter(Context context, int textViewResourceId, String[] objects) 6 /* 7 *public ArrayAdapter(Context context, int textViewResourceId, T[] objects) 8

Choose adapter dynamically depending on librarie(s) installed

…衆ロ難τιáo~ 提交于 2019-11-27 22:22:35
问题 I am designing a library that has adapters that supports a wide-range of libraries. I want the library to dynamically choose which ever adapter that has the library it uses installed on the machine when importing specific classes. The goal is to be able to change the library that the program depends on without having to make modifications to the code. This particular feature is for handling RabbitMQ connections, as we have had a lot of problems with pika, we want to be able to change to a

C# 监控网速

那年仲夏 提交于 2019-11-27 21:52:34
主要有两个类,其一是NetworkAdapter,该类的作用是获取本机网络适配器列表,并且可以通过该类的属性获取当前网速数据;其二是NetworkMonitor,该类是通过.NET的PerformanceCounter(性能计数器组件)监测本机每一个网络适配器对应的当前网速状况(翻译得不大好,具体还是看原汁原味的代码吧:)) NetworkAdapter类 using System; using System.Diagnostics; namespace NetWorkSpeedMonitor { /// <summary> /// Represents a network adapter installed on the machine. /// Properties of this class can be used to obtain current network speed. /// </summary> public class NetworkAdapter { /// <summary> /// Instances of this class are supposed to be created only in an NetworkMonitor. /// </summary> internal NetworkAdapter(string name) { this

Using Cursor with ListView adapter for a large amount of data

六月ゝ 毕业季﹏ 提交于 2019-11-27 21:38:30
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.show(); Log.e("TAG","Posle nov mAdapter"); } @Override protected CustomCursorAdapter doInBackground

Android - How to get an icon of an app?

丶灬走出姿态 提交于 2019-11-27 19:01:00
问题 I am trying to display a list of task in this way - Icon | ApplicationName | CheckBox As i found that no listview adapter supports this so i decided to develop a custom adapter but i am unable to fetch the icon of an application. So far i tried this :- public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; View row = inflater.inflate(R.layout.item, parent, false); CheckedTextView ctb = (CheckedTextView)row.findViewById(R.id.checkText); String pkgName =

Best place to addHeaderView in ListFragment

旧街凉风 提交于 2019-11-27 18:59:56
I'm having some trouble setting up my custom header in my list. I'm creating a ListFragment with a custom adapter. I have the list working fine, but I'm trying to figure out where in the lifecycle of a Fragment to attach the header. I know the header has to be added before you set your adapter. I tried adding my header in onActivityCreated, but that gets called every time my Fragment comes back from the backstack, and since I also set my adapter in onActivityCreated, it fails. I tried adding it in onCreate, but the view hierarchy isn't available at that stage of the lifecycle. I tried adding

License problem using sectioned ListView with J. Sharkey's SeparatedListAdapter [closed]

不羁岁月 提交于 2019-11-27 18:58:39
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . big explanation (better safe...), question in bold if you don't want to read it all. Thanks a lot for your help! I have an app with a ListView , and two custom XMLs. One is a single TextView, for the headers. The other has 3 TextViews and 3 ImageViews that represent the data. As most of you know, Jeff Sharkey

ViewHolder pattern correctly implemented in custom CursorAdapter?

廉价感情. 提交于 2019-11-27 18:46:33
Here is my custom CursorAdapter: public class TasksAdapter extends CursorAdapter implements Filterable { private final Context context; public TasksAdapter(Context context, Cursor c) { super(context, c); this.context = context; } /** * @see android.widget.CursorAdapter#newView(android.content.Context, android.database.Cursor, android.view.ViewGroup) */ @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(context); View v = inflater.inflate(android.R.layout.simple_list_item_checked, parent, false); ViewHolder holder =