adapter

Custom CursorAdapter, ListView is shifting

送分小仙女□ 提交于 2020-01-06 13:55:50
问题 My class extends SimpleCursorAdapter. In that class I try to get CallLog into ListView (with three TextViews (number, name and date) and two ImageViews (which represents incoming and outgoing calls). My code in OnCreate method: Cursor c = getContentResolver().query(android.provider.CallLog.Calls.CONTENT_URI, null, "TYPE IN (\"1\",\"2\")", null, "DATE DESC"); startManagingCursor(c); String[] from = new String[] {"number", "name" , "_ID" }; int[] to = new int[] {R.id.number, R.id.name, R.id

Custom CursorAdapter, ListView is shifting

折月煮酒 提交于 2020-01-06 13:55:39
问题 My class extends SimpleCursorAdapter. In that class I try to get CallLog into ListView (with three TextViews (number, name and date) and two ImageViews (which represents incoming and outgoing calls). My code in OnCreate method: Cursor c = getContentResolver().query(android.provider.CallLog.Calls.CONTENT_URI, null, "TYPE IN (\"1\",\"2\")", null, "DATE DESC"); startManagingCursor(c); String[] from = new String[] {"number", "name" , "_ID" }; int[] to = new int[] {R.id.number, R.id.name, R.id

With androidx.appcompat library FirebaseRecyclerAdapter not working

北慕城南 提交于 2020-01-06 01:54:27
问题 When upgrading build tool version and target SDK version to API 28 we have to use new support libraries with androidx prefix. I have replaced all libs with new libs here they are // Libs for newer API 28 implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.google.android.material:material:1.1.0-alpha01' implementation 'androidx.cardview:cardview:1.0.0' Now FirebaseRecyclerAdapter from the import below, asking

虚拟机网络模式及配置

a 夏天 提交于 2020-01-05 08:43:28
一、Bridged(桥接模式) 转http://www.linuxidc.com/Linux/2016-09/135521p3.htm 什么是桥接模式?桥接模式就是将主机网卡与虚拟机虚拟的网卡利用虚拟网桥进行通信。在桥接的作用下,类似于把物理主机虚拟为一个交换机,所有桥接设置的虚拟机连接到这个交换机的一个接口上,物理主机也同样插在这个交换机当中,所以所有桥接下的网卡与网卡都是交换模式的,相互可以访问而不干扰。在桥接模式下,虚拟机ip地址需要与主机在同一个网段,如果需要联网,则网关与DNS需要与主机网卡一致。其网络结构如下图所示: 接下来,我们就来实际操作,如何设置桥接模式。 首先,安装完系统之后,在开启系统之前,点击“编辑虚拟机设置”来设置网卡模式。 点击“网络适配器”,选择“桥接模式”,然后“确定” 在进入系统之前,我们先确认一下主机的ip地址、网关、DNS等信息。 然后,进入系统编辑网卡配置文件,命令为vi /etc/sysconfig/network-scripts/ifcfg-eth0 添加内容如下: 编辑完成,保存退出,然后重启虚拟机网卡,使用ping命令ping外网ip,测试能否联网。 能ping通外网ip,证明桥接模式设置成功。 那主机与虚拟机之间的通信是否正常呢?我们就用远程工具来测试一下。 主机与虚拟机通信正常。 这就是桥接模式的设置步骤

Custom ListView Adapter Showing Incorrect Values [Mono Android]

自作多情 提交于 2020-01-05 04:02:12
问题 Hello Stack Overflow Android Users, Please help with the following question: Problem I'm writing an a feature for an app that lists species of fish. I'm using a custom ListView Adapter class (let's call this FishSpeciesListAdapter ) for the adapter. I have 27 fish species recorded as a default for the program as for now (you will eventually be able to add some yourself as well). The problem is that when I link the adapter to the actual listview xml object, it seems to iterate over the same 5

how to insert the data from the adapter to the listview

孤街醉人 提交于 2020-01-05 03:33:37
问题 In my activity I have one adapter contains 25 items , and I have one listview. I want to insert 5 items in the listview and if I press the next button in my ativity ,the page will reloads with the next 5 items and so on. 回答1: Alter the items in the adapter, and then call notifyDataSetChanged() on the adapter. adapter.clear(); adapter.addAll(nextFiveElements); adapter.notifyDataSetChanged(); Also, be scrupulous about using the ViewHolder pattern. When implementing getView(), utilizing this

What design/pattern to use for a Client application using multiple providers?

自作多情 提交于 2020-01-05 02:10:49
问题 This is a design related question. Lets say we have a public API called ClientAPI with a few web methods like CreateAccount, GetAccount. Depending on the customer, we use a number of different providers to fulfil these requests. So say we have ProviderA and ProviderB and ProviderC. ProviderA has a method signature/implementation of CreateAccount that needs (Firstname, Lastname) only and creates an account with ProviderA. ProviderB has a method signature/implementation of CreateAccount that

adapters notifyDataSetChanged does not work

穿精又带淫゛_ 提交于 2020-01-04 02:53:28
问题 EDIT 2: I did solve my problem, but i don't know how:S I was moving my code snippets a bit around, a suddenly it worked. Must have done something in the wrong order, but its weird, checked it many times. Thanks for you help, and sorry I can't post an answer ;) Hi. I have a list view which I'm trying to refresh to update it self when i add an element to the underlying array list. Here is the code snippet: private void addEvent() { arrlEvents.add( event ); adptEvents.notifyDataSetChanged();

Listview, custom adapter and checkboxes

岁酱吖の 提交于 2020-01-02 10:27:22
问题 i got an issue with my adapter. Here is the code: @Override public View getView(final int position, final View convertView, final ViewGroup parent) { final ViewHolder viewHolder; View view = convertView; if (view == null) { view = LayoutInflater.from(mContext).inflate(R.layout.row, parent, false); viewHolder = new ViewHolder(); viewHolder.textTitle = (TextView) view.findViewById(R.id.title); viewHolder.checkBox = (CheckBox) view.findViewById(R.id.checkBox); viewHolder.checkBox.setTag(position

Web image loaded by thread in android

China☆狼群 提交于 2020-01-02 10:04:20
问题 I have an extended BaseAdapter in a ListActivity: private static class RequestAdapter extends BaseAdapter { and some handlers and runnables defined in it // Need handler for callbacks to the UI thread final Handler mHandler = new Handler(); // Create runnable for posting final Runnable mUpdateResults = new Runnable() { public void run() { loadAvatar(); } }; protected static void loadAvatar() { // TODO Auto-generated method stub //ava.setImageBitmap(getImageBitmap("URL"+pic)); buddyIcon