編輯:Android開發教程
在創建Bindings時,也可以不給出綁定的目標,通常用於含有@ImplementedBy 和@ProvidedBy (後面介紹)的實類(Concrete classes 或type)。 Untargeted bindings 目的是通知Injector 某個類類型,從而Injector可以預先准備某個依 賴。Untargetted Bindings不含to語句。
例如:
bind (MyConcreteClass.class); bind(AnotherConcreteClass.class).in(Singleton.class);
但如果此 時需要同時使用binding annotations 時,需要為綁定添加目標,即使是綁定到 同一個實類,如:
bind(MyConcreteClass.class)
.annotatedWith(Names.named("foo"))
.to(MyConcreteClass.class);
bind(AnotherConcreteClass.class)
.annotatedWith(Names.named("foo"))
.to(AnotherConcreteClass.class)
.in(Singleton.class);
Android實現進程間通信的實例
Android Service是分為兩種:本地服務(Local Service): 同一個apk內被調用遠程服 務(Remote Service):被另一個apk調用遠程
Android開發入門(二)使用意圖 2.5 使用Intent調用內置應用程序
我們已經了解了如何在自己的單個應用中調用activity。但是,android開發中比較重要的一點,就是使 用intent調用其他應用的activity。特別地,你的應用
Android ApiDemos示例解析 (27)
App->Notification->Notifying Service Controller這個例子介紹了如何在Service中使用Notification
Android ApiDemos示例解析(22) App->Dialog
這個例子的主Activity定義在AlertDialogSamples.java 主要用來介紹類AlertDialog的用法,AlertDialog提供的功能是多 樣的: