adapter

Sync Adapter without Account

ぃ、小莉子 提交于 2019-11-28 03:27:59
I need to fetch some data over the cloud from my app. I've watched the google IO video on RESTful android apps @ http://www.youtube.com/watch?v=xHXn3Kg2IQE&t=43m58s It recommends in the final slides to use a SyncAdapter to integrate with the Android System. Later I learned that one has to use an Account to implement SyncAdapter. My app does not use an account. Users can freely download data without registration. Can I still use SyncAdapter? Is there a stock dummy account that I could use? Edit: I do have a content provider for my app so that's not a problem Edit2: I've just looked at the

Understanding Adapter Pattern

本秂侑毒 提交于 2019-11-28 03:20:47
I am trying to understand Adapter pattern and its use in real world. After going through various articles on internet and www.dofactory.com, I created this sample code. I just want to know whether my understanding is correct. In the example below I have created MSDAO object in the Adaptor class. Later I changed it to OracleDAO. class Client { static void Main(string[] args) { ITarget objAdapter = new Adapter(); object dummyObject = objAdapter.GetData(); } } Interface ITarget { public void GetData(); } //Decision to use MSDAO class Adapter : ITarget { public void GetData() { MSDAO objmsdao =

GridView inside Expandable list in android

守給你的承諾、 提交于 2019-11-28 03:20:25
I want to put an gridview with images inside an expandable list...I've already make that, but the gridview don't show all item... How can i make my expandable list child adapt to the gridview size? LIST ADAPTER public class CustomListAdapter extends BaseExpandableListAdapter { String[] catg = { "Administração, Escritorio e Industria", "Cultura e Entretenimento", "Educação e Crianças", "Eventos e Estado do tempo", "Amigos, Familia e Habitações", "Multimédia", "Diversos", "Números e Letras", "Restaurantes e Hoteis", "Desporto, Saude e Beleza", "Lojas", "Turismo e Natureza", "Transportes" };

[转] 有关Android线程的学习

断了今生、忘了曾经 提交于 2019-11-28 02:38:55
1. Android进程 在了解Android线程之前得先了解一下Android的进程。 当一个程序第一次启动的时候,Android会启动一个LINUX进程和一个主线程。默认的情况下,所有该程序的组件都将在该进程和线程中运行。 同时,Android会为每个应用程序分配一个单独的LINUX用户。Android会尽量保留一个正在运行进程,只在内存资源出现不足时,Android会尝试停止一些进程从而释放足够的资源给其他新的进程使用, 也能保证用户正在访问的当前进程有足够的资源去及时地响应用户的事件。Android会根据进程中运行的组件类别以及组件的状态来判断该进程的重要性,Android会首先停止那些不重要的进程。按照重要性从高到低一共有五个级别: 前台进程 前台进程是用户当前正在使用的进程。只有一些前台进程可以在任何时候都存在。他们是最后一个被结束的,当内存低到根本连他们都不能运行的时候。一般来说, 在这种情况下,设备会进行内存调度,中止一些前台进程来保持对用户交互的响应。 可见进程 可见进程不包含前台的组件但是会在屏幕上显示一个可见的进程是的重要程度很高,除非前台进程需要获取它的资源,不然不会被中止。 服务进程 运行着一个通过startService() 方法启动的service,这个service不属于上面提到的2种更高重要性的。service所在的进程虽然对用户不是直接可见的

Android UI学习 - ListView

拟墨画扇 提交于 2019-11-28 02:38:55
ListActivity ListActivity是一个专门显示ListView的Activity类,它内置了ListView对象,只要我们设置了数据源,就会自动地显示出来。 使用custom view for screen layout 虽然ListActivity内置了ListView对象,但我们依然可以使用custom view,通过在onCreate()里面调用 setContentView(resources id) 。 不过要注意的是, 在自定义的Layout里面,要设置ListView对象的id为"@android:id/list";在Java代码里使用android.R.id.list 。 下面的例子,通过添加一个id为android:empty的TextView,当ListView里面没有data的时候,就会显示"No data"。 自定义的View (listview.xml): <? xml version ="1.0" encoding ="utf-8" ?> < LinearLayout xmlns:android ="http://schemas.android.com/apk/res/android" android:orientation ="vertical" android:layout_width ="fill_parent" android

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

北慕城南 提交于 2019-11-28 02:31:50
What is the difference between the Facade, Proxy, Adapter, and Decorator design patterns? I have never read a clear explanation, what's yours? dirkgently Adapter adapts a given class/object to a new interface. In the case of the former, multiple inheritance is typically employed. In the latter case, the object is wrapped by a conforming adapter object and passed around. The problem we are solving here is that of non-compatible interfaces . Facade is more like a simple gateway to a complicated set of functionality. You make a black-box for your clients to worry less i.e. make interfaces simpler

Set an XJC javaType adapter in external binding file

不羁岁月 提交于 2019-11-28 02:13:47
I've an XSD file containing this: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jaxb:extensionBindingPrefixes="xjc" elementFormDefault="qualified" targetNamespace="http://example.org/"> <xsd:complexType name="Certificate"> <xsd:sequence> <xsd:element name="certificate" type="xsd:base64Binary"> <xsd:annotation> <xsd:appinfo> <xjc:javaType name="java.security.cert.X509Certificate" adapter="adapters.X509CertificateAdapter" /> </xsd:appinfo> </xsd:annotation> </xsd:element> </xsd:sequence> </xsd

Net中的设计模式——从实例谈Adapter模式

こ雲淡風輕ζ 提交于 2019-11-28 01:53:26
转载: http://www.cnblogs.com/wayne-ivan/archive/2006/09/07/496922.html 在系列一中, RM和MPEG类继承了VideoMedia抽象类,而VideoMedia类又实现了IMedia接口,该接口仅仅提供了Play()方法。冰汽水的意思是希望为RM,MPEG提供与AudioMedia不同的属性和方法。例如,对于视频媒体而言,应该有一个调整画面大小的方法,如Resize()。而这个方法是IMedia接口所不具备的。 那么怎样为RM,MPEG类提供IMedia接口所不具备的Resize()方法呢?非常自然地,通过这个问题我们就引出Adapter模式的命题了。首先,要假设一个情况,就是原文的所有代码,我们是无法改变的,这包括暴露的接口,类与接口的关系等等,都无法通过编码的方式实现新的目标。只有这样,引入Adapter模式才有意义。 熟悉Adapter模式的人都知道,Adapter模式分为两种:类的Adapter模式、对象的Adapter模式。下面我试图根据本例对两种方式进行说明及实现。在实现Adapter模式之前,有必要看看原来的类结构: 左边橙色的类为音频媒体类型,右边蓝色的类为视频媒体类型。所有的这些类型,包括类和接口都是无法改变的。现在我们的目的就是要让RM、MPEG具有Resize()方法

How to increase the adapter procedure timeout value in Worklight?

独自空忆成欢 提交于 2019-11-28 01:41:42
How can I increase the timeout value of a Worklight adapter procedure? My app crashes and I see the following in the exception details: "response [/apps/services/api/index/common/query] success: / -secure- {"responseID":"24","errors":["Invocation of procedure 'getFTTitle' has timed out after 30 sec."],"isSuccessful":false,"warnings":[],"info":[]} / " There are several places in Worklight where a timeout value can be specified: CLIENT ----> WORKLIGHT SERVER -- (adapter) --> BACKEND You can increase the adapter procedure timeout (Worklight Server --> Backend) as follows: <procedure name=

网络数据包收发流程(三):e1000网卡和DMA

扶醉桌前 提交于 2019-11-28 01:00:35
转载 https://www.cnblogs.com/CasonChan/p/5166239.html 一、硬件布局 每个网卡(MAC)都有自己的专用DMA Engine,如上图的 TSEC 和 e1000 网卡intel82546。 上图中的红色线就是以太网数据流,DMA与DDR打交道需要其他模块的协助,如TSEC,PCI controller 以太网数据在 TSEC<-->DDR PCI_Controller<-->DDR 之间的流动,CPU的core是不需要介入的 只有在数据流动结束时(接收完、发送完),DMA Engine才会以外部中断的方式告诉CPU的core 二、DMA Engine 上面是DMA Engine的框图,以接收为例: 1. 在System memory中为DMA开辟一端连续空间,用来BD数组 (一致性dma内存) BD是给DMA Engine使用的,所以不同的设备,BD结构不同,但是大致都有状态、长度、指针3个成员。 2. 初始化BD数组,status为E,length为0 在System memory中再开辟一块一块的内存,可以不连续,用来存放以太网包 将这些内存块的总线地址赋给buf(dma映射) 3. 当MAC接收以太网数据流,放在了Rx FIFO中 4. 当一个以太网包接收完全后,DMA engine依次做以下事情 fetch bd