Skip to main content

Home/ Groups/ Android Dev
Vincent Tsao

[Android研究手记3]组件间的交互和进程间IPC通信 « hkbarton - Undefined Life - 2 views

  • 基于Unix(Linux)的系统都有一个很优秀的传统,就是倡导非常轻便的进程间通信(IPC)机制;倡导进程通过IPC来互相协作;倡导功能单一,小巧而强壮的进程,而不是又大又复杂的“万金油”
  • Android的组件和进程间通信都建立在一种基于称为Intent的消息基础之上。Intent就是一种消息,它包含了两个重要的内容:1. 消息的目的,即这个消息是发给哪个组件的?(消息的目的中不会包含“消息是发给哪个进程”这样的信息,这里Android有意淡化进程的概念,而只让我们关心组件,因为了解太多关于进程的具体信息会加大复杂度,而又如何做到进程间的消息传递呢?下文会说到一种Android中关于这点比较特别的设计方式,我认为是一种简捷有用又符合手机特点的设计);2. 消息所携带的数据内容,即需要传递给目标的数据。下面是一个简单的利用Intent来启动一个Service并向其传递数据的代码示例
  • 这种模式的消息由于已经确切知道了消息目标的确切信息,所以只适用于同一进程内的不同组件之间通信,例如打开一个子窗体,和同一进程中的service通信等。对应的,隐式消息就一般用于跨进程的通信了,隐式消息没有确定的消息目的地,除了数据外,隐式消息只是包含了一些用于表征消息特征的描述字段
  • ...1 more annotation...
  • 隐式消息这个设计简单有效,它忽略了进程的细节,让IPC在一个更高的更接近人脑思维模式的层次工作,让系统中的不同进程协作看起来就像是同一程序中的协作一样,这种简单的IPC机制在很大的程度上鼓励我们和其他进程协作,通过协作的进程来完成一个复杂的任务,而不是把什么功能都做到一个大而全的程序里面
Vincent Tsao

解决办法之Error generating final archive: Debug certificate expired on « 岩屋(Flash/... - 1 views

  • Eclipse 编译 Android工程时,提示该错误 :Error generating final archive: Debug certificate expired on xxxxxx(日期) 解决办法: linux:Window--》Preferences--》Android--》Build中Default debug keystore显示了地址“/home/jinli/.android/debug.keystore”,删除此路径下的debug.keystore及 ddms.cfgWindow XP:进入:C:Documents and SettingsAdministrator.android 删除:debug.keystore及 ddms.cfg
Vincent Tsao

Android :Google 收入的生命线 | 爱范儿: 拇指资讯小众讨论 - 1 views

  • 据市场调研公司尼尔森的统计,过去六个月,Android 已经超越 BlackBerry  OS 和 IOS 成为美国消费者购买智能手机的首选。如图,Android 在今年四月超越了一直低迷的  IOS 之后,在七月份又超越了持续下滑的BlackBerry  OS 。但从市场总份额来看,黑莓仍占主导地位
  • 面对这一骄人的数字,Google 的 CEO 施密特倒是显得荣辱不惊。他表示,尽管并不直接从 Android 获利,但是基于 Android 的手机已产生足够的广告收入,足以支撑 Android 的开发成本
  • 随着 Android 手机的大幅增长,由 Android 带来的广告业务有望每年为公司带来“高达100亿美元的收入”。而这一数字将是 Google 今年总营收的一半。 此前在接受《华尔街日报》的采访时,施密特曾表示,他希望有朝一日能有 10 亿 的 Android 手机用户。这样,只要每个用户每年消费 10 美元,就能达到这个目标
Vincent Tsao

gmailwidgetplus - Project Hosting on Google Code - 1 views

  • This projects aims to provide a way to access unread emails regardless of label directly from the android home screen. This project releases directly to the Android Market and as such the download section here may be behind.
Vincent Tsao

javadoc注释规范 - kelaocai - JavaEye技术网站 - 0 views

  • /** * show 方法的简述. * <p>show 方法的详细说明第一行<br> * show 方法的详细说明第二行 * @param b true 表示显示,false 表示隐藏 * @return 没有返回值 */ public void show(boolean b) { frame.show(b); }
  • javadoc 标记由“@”及其后所跟的标记类型和专用注释引用组成 javadoc 标记有如下一些: @author 标明开发该类模块的作者 @version 标明该类模块的版本 @see 参考转向,也就是相关主题 @param 对方法中某参数的说明 @return 对方法返回值的说明 @exception 对方法可能抛出的异常进行说明 @author 作者名 @version 版本号 其中,@author 可以多次使用,以指明多个作者,生成的文档中每个作者之间使用逗号 (,) 隔开。@version 也可以使用多次,只有第一次有效 使用 @param、@return 和 @exception 说明方法 这三个标记都是只用于方法的。@param 描述方法的参数,@return 描述方法的返回值,@exception 描述方法可能抛出的异常。它们的句法如下: @param 参数名 参数说明 @return 返回值说明 @exception 异常类名 说明
Vincent Tsao

The CommonsBlog - Activity or Notification via Ordered Broadcast - 0 views

  • I’ve run into the following generalized question a lot recently: I have an event that occurs in the background. I want to update my activity, if the activity is on the screen. Otherwise, I want to raise a Notification.
  • Hence, the recipe for the activity-or-Notification pattern is: Define an action string you will use when the event occurs that you want to go to the activity or notification (e.g., com.commonsware.java.packages.are.fun.EVENT). Dynamically register a BroadcastReceiever in your activity, with an IntentFilter set up for the aforementioned action string and with a positive priority (the default priority for a filter is 0). This receiver should then have the activity do whatever it needs to do to update the UI based on this event. The receiver should also call abortBroadcast() to prevent others from getting it. Be sure to register the receiver in onStart() or onResume() and unregister the receiver in the corresponding onStop or onPause() method. Register in your manifest a BroadcastReceiver, with an <intent-filter> set up for the aforementioned action string. This receiver should raise the Notification. In your service (e.g., an IntentService), when the event occurs, call sendOrderedBroadcast(). And that’s it. If the activity is on-screen, its receiver will be registered, so it will get the event, process it, and cancel the broadcast. If the activity is not on-screen, its receiver will not be registered, so the event will go to the default handler, in the form of your manifest-registered BroadcastReceiver, which will raise the Notification.
Vincent Tsao

How to update the GUI in Push/C2DM sample from advandroid book? - cw-android | Google G... - 0 views

  • > Now I just want to update the GUI from this method. > Can I somehow call a method in PushEndpointDemo.java? No, for two reasons: 1. Because C2DMReceiver is a manifest-registered BroadcastReceiver and therefore has no access to any activities 2. There might not be an activity, since you have no control over the timing of when the C2DM message is received (e.g., the user pressed BACK, the user pressed HOME) > Do I need a Broadcast Intent to do this? Possibly. -- If you want to update an activity or else ignore the message, have C2DMReceiver send out a private broadcast, picked up by a receiver registered via registerReceiver() in the activity -- If you want to update an activity or else raise a notification, have C2DMReceiver send out an ordered broadcast, as described here: http://commonsware.com/blog/2010/08/11/activity-notification-ordered-... -- If you want to update a database, call startActivity() on an IntentService, and have it do the database I/O, plus possibly broadcast an Intent to update an activity/raise a notification.
Vincent Tsao

Android Dev Phone, Ubuntu and VMWare Server : Johan de Koning - 0 views

  • Create a new file (as root) sudo gedit /etc/udev/rules.d/50-android.rules with the following content SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666" Make sure that the text after {idVendor} is the same as the device id found when using the lsusb command. Save and exit the editor To make execution of the rule possible, perform a chmod sudo chmod a+rx /etc/udev/rules.d/50-android.rules To make the rule active, restart udev sudo /etc/init.d/udev restart
  • You can perform a check, to see that the Android Dev Phone is shared with Ubuntu, by opening a Terminal (inside Ubuntu. Open a VMWare Remote Console to make use of the Ubuntu) and type the following command lsusb A list of USB devices will be shown. For example: Bus 002 Device 001: ID ld6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 004: ID 0bb4:0c02 High Tech Computer Corp. Bus 001 Device 001: ID ld6b:0002 Linux Foundation 2.0 root hub
Vincent Tsao

[筆記]讓Android emulator連intranet « 更夜 - 0 views

  • [通用部分] 如果開了一個以上的模擬器的話請自行加adb參數 0a. 先adb pull /system/etc/hosts hosts抓回local來修改。 0b. 在原本的 127.0.0.1 localhost 加上新的行,寫入你需要的對應如 192.168.1.15 mytestsite,存檔。 1. adb remount (才不會發生Read-only file system錯誤) 2. adb push hosts /system/etc/hosts
  • [2.0.1, 2.1 only] 這兩個版本會在這邊丟出錯誤訊息,分別為 failed to copy 'hosts' to '/system/etc/hosts': No space left on device failed to copy 'hosts' to '/system/etc/hosts': Out of memory 解決方法是,開啟模擬器時不要直接從 AVD Manager介面開,請下指令: $ emulator -avd youravdname -partition-size 128 接著再對這個模擬器使用上面的 hosts修改大法就不會出現錯誤了。 partition size的單位是MB,預設似乎是64。從adb shell 用 df 指令觀察的結果,/system 和 /data 都會被這個設定成這邊指定的值。而1.5, 1.6 的 image 因為剛好沒超過 64MB,還剩下一點空間,所以 hosts 還寫得進去,而 2.x 的 image 有 七萬多K,mount之後 /system 這個 partition 看起來就是全滿,剩下空間 0K。因此 hosts變肥後無法寫入,真的是因為partition爆了。事實上正常的手機確實也不需要留空間給user hack…模擬器還讓我們調參數已經很偷笑了,可惜AVD Manager 的 Start 沒地方可以設定 partition size。若有此需求的話只好麻煩一點手動下指定開emulator囉。
Vincent Tsao

Authenticating against App Engine from an Android app - Nick's Blog - 0 views

  • Authentication with App Engine, regardless of where you're doing it, is a three-stage process: Obtain an authentication token. This can be done with ClientLogin for installed apps, for example, or with AuthSub for a webapp. When logging in directly to an application, this is the part of the login process where your user sees a Google signin screen. Take that authentication token, and use it to obtain an authentication cookie. Use that authentication cookie in all subsequent requests.
  • <uses-permission android:name="android.permission.GET_ACCOUNTS"></uses-permission> <uses-permission android:name="android.permission.USE_CREDENTIALS"></uses-permission> <uses-permission android:name="android.permission.INTERNET"></uses-permission>
Vincent Tsao

请教,使用layout_gravity属性不能垂直居中 - China Android Dev | Google Groups - 0 views

  • 按我理解,layout_gravity 属性是用于设置View 与其容器的对齐关系的,但实际使用中 却发现 似乎不是这样,请看如下代码: <?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:layout_height="fill_parent"     android:background="#AA009988">     <TextView         android:id="@+id/my_view"         android:layout_width="220dip"         android:layout_height="100dip"         android:text="sdfasdfsdfsdf\nsdfjlwjesd"         android:background="#889900AA"         *android:layout_gravity="center"* /> </LinearLayout> 我为 TextView 设置了 *layout_gravity="center"*- ,本来它应该在父容器中 垂直和水平 居中的,但事实上只是水平居中了,垂直方向并未居中。 我再进一步通过 *layout_gravity="**center_vertical**"* ,但仍然无法垂直居中,请问这是为什么呢?
  • 你可以在最外面的 LinearLayout 加上android:gravity="center". Vertical LinearLayout中, layout_gravity 设置成center无法垂直剧中,是因 为container的排版被限制为从上到下, 试想一下,如果按照你的逻辑,假设第一个child layout_gravity设置成bottom,   第二个childlayout_gravity设置成top,  那么第一个就会跑到第二个下面了。 所以, 当你设置整个linearlayout为垂直, layout_gravity中, 只有 left, right, center_ horizontal 管用的。 tj
Vincent Tsao

最封闭的开源系统,话说Android的八宗罪 | ifanr 爱范儿 ♂专注于拇指设备的小众讨论 - 0 views

  • 没错,Google 的移动平台是当前最聪明的利用开源来驱动商业议程的实现
  • 虽然早期饱受质疑,Google 的 Android 移动平台已经在移动行业得到了营运商和手机厂商的广泛支持,仅剩固执的诺基亚。Android 从 08 年的一款机型发展到 10 年的 50 多款,发展之快让绝大多数的业内观察家们吃惊
  • 话说回来,Android 用开源来做市场宣传,非常成功的搅乱了整个行业,导致了诺基亚对 Symbian 的收购以及 Windows Mobile 的全面崩溃(不过译者觉得 iPhone OS 4 的多重任务机制的发布让 WP7 真正成了杯具帝)。不过更重要的是,利用开源的名号和 Google 的魅力,Android 吸引了成千上万的开发者,虽然 Android 并不能让开发者们赚到很多钱,而且 Android 手机的数量不到苹果产品的十分之一(连支持收费的国家都比苹果少6倍)。
  • ...3 more annotations...
  • 进化的速度. Google 对 Android 的创新的速度是移动行业内绝无仅有的,他们在 18 个月里发布了四个大版本。想在 Android 上面做文章的 OEM 厂商只得紧跟 Google 的步伐(这里想起了移动杯具的 OMS),不然就跟不上新功能的发布和 bug 修复。Nexus One、Droid、G1 和其它带有 Google体验应用的手机给 Google 提供了创新的测试场
    • Vincent Tsao
       
      HTC也很杯具,2.1直到几周前才完全ready,而这时2.2也将要井喷了
  • 借用亨利福特在 Model-T 相关的书里的一句话:“任何人都可以自由挑选 Android 的颜色,只要那是黑色”(anyone can have Android in their own colour as long as it’s black)。Android 是一个绝好的商业案例——展现一家公司是如何用开源来赢得关注和社区参与,而且同时保持一个非常严密的商业运作。
  • 手握 Android,Google 的目标是为自己产生收入的服务提供一个稳定的平台。在当前,这个广告生意。但未来,Google 的目标在语音服务(几十亿没有数据服务的用户)和 Google Checkout(比如变成移动领域的 visa 卡)。但不管 Google 的终极目标是什么,我们应该意识到 Android 和 Windows Mobile、Mac OSX 或 PalmOS 相比,并没有开放多少。Android 是用开源来驱动商业议程的最聪明的案例之一。Android 骨子里并没有我们潜意识里所灌输的那么多不作恶思想。
  •  
    关于Android的其他声音,猛的发现还是Hong大哥翻译的
« First ‹ Previous 201 - 220 of 497 Next › Last »
Showing 20 items per page