jfo planet

Hope is the best gift that tomorrow gives.

  • 首页
  • 分类
  • 归档
  • 标签
  • 搜索
close

【zz】What is the role of WindowManager in android frame

发表于 2010-07-12   |   分类于 Android
http://blog.chinaunix.net/u2/85805/showart_1883499.htmlI understand Windows manager is a separate service in the android framework. I am wondering whether Window manager is like X Server or not. Lets say I have an activity with many views in it. When an activity changes screen (i.e paint screen), Does it directly draw on the drawing surface or request Window manager to draw on the activity’s behalf?>>>The window manager creates surfaces for the application, and applications draw direct ...
阅读全文 »

Android IPC通讯机制

发表于 2010-07-12   |   分类于 Android
Android IPC 通讯机制源码分析android的binder机制研究
阅读全文 »

平均分布example——layoutItemsUsingGravity()

发表于 2010-07-12   |   分类于 Android
自动将各个item平均分布:/ Figures out the layout for the menu items by equally distributing, and adding any excess items equally to lower rows. @param numRows The total number of rows for the menu view @param numItems The total number of items (across all rows) contained in the menu view @return int[] Where the value of index i contains the number of items for row i / private void layoutItemsUsingGravity(int numRows, int numItems) { int numBase ...
阅读全文 »

Android 2.2 Froyo新特性

发表于 2010-07-04   |   分类于 Android
App2SD眾所期盼可以安裝 App 到 SD card 上的功能在 2.2 上實現了,使用者在設定→應用程式→管理應用程式內可以看到新版本採用 Tab 區分不同類型的 App(以往是要按 Menu Key 選不同的 Filter 過濾出要看的 App),多了一個於 SD 卡的 Tab。 點選 Ap 後可以在手機內部記憶體跟 SD card 間自行搬移 App 存放的位置,前提是 App 要允許能夠安裝在 SD card 上。 為此,新版本 SDK 在 AndroidManifest.xml 內新增了 android:installLocation 屬性讓開發者決定程式是要安裝在內部記憶體還是 SD card 上,其值可以是 "internalOnly"、"auto"、"preferExternal" 三選一,但注意看 preferExternal 的說明The application prefers to be installed on the external storage (SD card). Ther ...
阅读全文 »

【zz】How to Handle Java Finalization's Memory-Retention Issues

发表于 2010-07-04   |   分类于 Java
How to Handle Java Finalization’s Memory-Retention IssuesFinalization is a feature of the Java programming language that allows you to perform postmortem cleanup on objects that the garbage collector has found to be unreachable. It is typically used to reclaim native resources associated with an object. Here’s a simple finalization example: public class Image1 { // pointer to the native image data private int nativeImg; private Point pos; ...
阅读全文 »

【zz】理解 Java 的 GC 与 幽灵引用

发表于 2010-07-04   |   分类于 Java
另参考:Android的智能指针——http://ytydyd.blog.sohu.com/139278565.html理解 Java 的 GC 与 幽灵引用Java 中一共有 4 种类型的引用 : StrongReference、 SoftReference、 WeakReference 以及 PhantomReference (传说中的幽灵引用 呵呵), 这 4 种类型的引用与 GC 有着密切的关系,  让我们逐一来看它们的定义和使用场景 :1. Strong ReferenceStrongReference 是 Java 的默认引用实现,  它会尽可能长时间的存活于 JVM 内, 当没有任何对象指向它时 GC 执行后将会被回收Java代码 @Test   public void strongReference() {       Object referent = new Object();  ...
阅读全文 »

解决android2.1中Youku每次都要选择默认播放器的问题

发表于 2010-06-29   |   分类于 Android
使用Android手机一段时间了,安装Youku的apk,用起来还不错,唯一有个麻烦的地方是,每次选择播放某个在线视频,都要选择一次默认播放器(我装了两个播放器),默认播放器的checkbox已经打勾了,每次还是要重新选择,应该是系统的一个bug。前段时间自己编译过Android2.1内核,现成的源代码放在那儿,不去改改可惜了。于是决定深入到内核当中,fix掉这个bug。每次在youku的客户端点击播放某个视频时,用adb logcat查看输出的log,可以发现很多有趣的东西,其中就显示了关于播放视频时系统产生的intent信息:I/ActivityManager( 1185): Starting activity: Intent { act=android.intent.action.VIEW dat=http://mf.youku.com/player/getFlvPath/sid/127781412835562_01/st/mp4/fileid/03002001004C24259FEC0F03A2FF2D6D3F3E0F-67A5-7C17-DFA2-581C1828F34C? ...
阅读全文 »

【zz】解读google C++ code style谈对C++的理解

发表于 2010-06-29   |   分类于 c++/c++ template/gp/boost
解读google C++ code style谈对C++的理解C++是一门足够复杂的语言.说它"足够复杂",是因为C++提供了足够多编程范式–泛型, 模板, 面向对象, 异常,等等.顺便说说,我已经很久没有跟进C++的最新发展了(比如C++0x), 所以前面列举出来的特性应该只是C++所有特性的一个部分罢了.C++特性过多很难驾驭好C++的原因之一.另一个原因是C++过于"自作聪明",在很多地方悄无声息的做了很多事情, 比如隐式的类型转换, 重载, 模板推导等等.而很多时候,这些动作难以察觉,有时候会在你意想不到的地方发生,即使是熟练的C++程序员也难免被误伤.(关于了解C++编译器自作聪明做了哪些事情, <<深入理解C++物件模型>>是不错的选择).世界上有很多问题, 人们知道如何去解决.但是, 似乎这还不算是最高明的,更高明的做法是学会避免问题的发生.而如何避免问题的发生, 需要经验的积累–曾经犯下错误,吃一堑长一智,于是知道哪些事情是不该做的或者是不应该这么做的.google C++ code style是goog ...
阅读全文 »

【zz】Android IPC 通讯机制源码分析

发表于 2010-06-28   |   分类于 Android
Android IPC 通讯机制源码分析Android IPC 通讯机制源码分析 —-Albertchen Binder通信简介: Linux系统中进程间通信的方式有:socket, named pipe,message queque, signal,share memory。Java系统中的进程间通信方式有socket, named pipe等,android应用程序理所当然可以应用JAVA的IPC机制实现进程间的通信,但我查看android的源码,在同一终端上的应用软件的通 信几乎看不到这些IPC通信方式,取而代之的是Binder通信。Google为什么要采用这种方式呢,这取决于Binder通信方式的高效率。 Binder通信是通过linux的binder driver来实现的,Binder通信操作类似线程迁移(thread migration),两个进程间IPC看起来就象是一个进程进入另一个进程执行代码然后带着执行的结果返回。Binder的用户空间为每一个进程维护着 一个可用的线程池,线程池用于处理到来的IPC以及执行进程本地消息,Binder通信是同步而不是异步。 Andro ...
阅读全文 »

HashSet-ArrayList-HashMap的线程同步控制方法

发表于 2010-06-25   |   分类于 Java
    Collections类中提供了多个synchronizedXxx,该方法返回指定集合对象对应的同步对象,从而可以解决多线程并发访问集合时的线程安全问题.   正如Java中常用的集合框架推荐使用的三个实现类:HashSetArrayListHashMap都是线程不安全的.如果有多条线程访问它们,而且有超过一条的线程试图修改它们,则可能出现错务.Collections提供了多个静态方法用于创建同步集合下面程序创建了四个同步的集合对象import java.util.*;public class  TestSynchronized{public static void main(String[] args){ //下面程序创建了四个同步的集合对象 Collection c=Collections.synchronizedCollection(new ArrayList()); List list=Collections.synchronizedList(ne ...
阅读全文 »
1…212223…61
jfo

jfo

605 日志
38 分类
4 标签
RSS
GitHub 微博
友情链接
  • 收藏夹
  • 网络剪贴板
  • 爱逛吧
© 2007 - 2018 jfo
由 Hexo 强力驱动
主题 - NexT.Pisces