
Android Activity
文章平均质量分 61
fyfcauc
这个作者很懒,什么都没留下…
展开
-
ViewRootImpl src track
ActivityThread.java:private Activity performLaunchActivity(ActivityClientRecord r, Intent customIntent) {...........................................................activity.attach(appContext, this,原创 2014-12-15 14:40:59 · 505 阅读 · 0 评论 -
android requestLayout等重绘分析
基于4.4.3ViewRootImpl.java scheduleTraversals()会先判断是否有 mTraversalRunnable 被post到 mChoreographer那里,如果没有,那么就post一个mTraversalRunnable(CALLBACK类型是Choreographer.CALLBACK_TRAVERSAL)到mChoreogr原创 2014-11-04 11:36:57 · 1641 阅读 · 0 评论 -
Download模块 (八)
Download模块 (八)KeyPressListener是一个体系,而不是一个单独的类,目的也很简单,就是一套传递keyPress信息的机制。这么做的原因是对于fragment这些非UI对象,是没有监听keyPress的功能的,而fragment虽然不是UI对象,但是UI对象的所有处理逻辑都在fragment中,因此fragment也需要能够感知keyPress。虽然当前原创 2015-02-28 11:39:07 · 538 阅读 · 0 评论 -
Android Activity launchMode Test
对 launchMode的简单测试:三个Activity, A, B, C, 分别属于不同的ApplicationB 和 C 都通过Intent setAction来startActivity A,在launchMode是缺省的每次都实例化的case下:B先启动A, A所在的Application被构造, A 构造函数被调用。然后菜单键回到launcher, 启动C,C启动原创 2015-02-11 14:45:42 · 395 阅读 · 0 评论 -
getWindowVisibleDisplayFrame DisplayUtil.getScreenSize() VKB影响
getWindowVisibleDisplayFrame得到的rect的尺寸是受VKB出现/消失的影响的。而DisplayUtil.getScreenSize()则不会.原创 2015-02-04 18:16:21 · 643 阅读 · 0 评论 -
Activity 的 setContentView draw时机
simple test:Activity setContentView 的 View 真正被draw() (开始调 dispatchDraw()) 时, Activity的onResume(), onStart()都已经调过了。原创 2014-12-17 18:53:06 · 930 阅读 · 0 评论 -
Activity 初始化成员 使用 getApplicationContext()
之前以为Activity在构造时(在初始化类成员时使用),getApplicationContext()就可以使用,因为当时看源码是发现getApplicationContex()最终会调到mBase, 而mBase则是ContextWrapper的一个内部成员,而mBase 在 ContextWrapper()构造时也会被赋值: public ContextWrapper(Contex原创 2014-12-11 11:50:11 · 919 阅读 · 0 评论 -
Android Fragment 体系源码跟踪笔记(3)
通常使用的supportv4的FragmentManager(一个接口)的具体实现就在其嵌套类FragmentManagerImpl中:beginTransaction()返回的其实一个FragmentTransaction的实现子类: BackStackRecord.executePendingTransactions(),就是调用execPendingActions()罢了,之前解释的已经很清原创 2015-05-13 18:10:23 · 926 阅读 · 0 评论 -
ActionBar隐藏与出现
项目做了一次小的启动优化, 由于某种原因,launchActivity被我拿掉直接并到了MainActivity里(专门为launch的splash准备一个Activity其实挺浪费的). 结果出现了著名的启动白屏问题, 这个问题之前就碰到过,root cause其实是android的渲染层机制,直接原因就是因为Activity使用了ActionBar(当然了,不知道sherlockactionb原创 2015-05-16 10:45:52 · 710 阅读 · 0 评论 -
Android Fragment 体系 源码追踪笔记(4)
FragmentState implements Parcelable, 这个就没啥多说的了,就是就一个Fragment 信息的holder,在 onSave/RestoreInstance时使用(不过可以了解一下整个Fragment体系的state的save/restore流程).再重申一下Fragment的6个状态(Fragment其实完全就是一个状态机):INITIALIZING = 0;原创 2015-05-16 13:42:28 · 680 阅读 · 0 评论 -
ActivityThread 源码笔记(1)
ActivityThread:虽然名字是Thread,但是本身并不继承自任何一个Thread类,其Thread的功能是通过内部维护的handler实现的.ActivityThread的static main函数(入口):前面是一系列的初始化:重要的初始化: Looper.prepareMainLooper(),为当前线程配置一个Looper并放在Looper类的相应的ThreadLocal原创 2015-05-17 21:56:15 · 1816 阅读 · 0 评论 -
Android ActivityManagerService 笔记(1)
ActiivtyManagerService的main(..)(该函数被调用的地方是是SystemServer.java的ServerThread的initAndLoop(),其所在线程是调用SystemServer.main(…)的线程): 先new一个AThread thr并启动, 然后一直无限循环thr.wait()直到thr.mService(ActivityManagerService原创 2016-04-03 14:48:33 · 798 阅读 · 0 评论 -
Android Activity ActionMode Callback
两个ActionMode在Activity的回调,记一下。注意这两个callback发生的时机都是onXXX,即事件是发生了,但是还没完成,就是ActionMode还没有完全的出现/消失.因此,某些时候,要做一些明确在ActionMode出现/消失的操作时,要把这些操作Delay到下一个slice. /** * Notifies the Activity原创 2015-02-13 11:31:44 · 1023 阅读 · 0 评论 -
Wallpaper模块(一)
Wallpaper模块(1)Picker是一个用于从交互的选取图片类的Activity中获得所选图片的类. Tool.对外开放Listen接口,取图成功和取图失败.Picker因为定位是一个tool,因此设计为单例模式,load Class 即生成实例. early-init.因为Picker其实只在WallPaper模块被使用,因此在设计的时候没有考虑pendin原创 2015-03-13 15:28:10 · 818 阅读 · 0 评论 -
简单分析Android中添加shortcut方面的源码
From: http://blog.youkuaiyun.com/zircon_1973/article/details/7773254首先要知道Launcher,就是主屏幕,它是Android系统启动后所加载的第一个程序,如下,主屏幕分成两部分,Workspace和Hotseats,而shortcut就是添加在workspace上的,这上面还可以添加诸如widget、文件夹等。这儿说的shortcu转载 2015-01-06 14:25:42 · 662 阅读 · 0 评论 -
Activity overridePendingTransition
/** * Call immediately after one of the flavors of {@link #startActivity(Intent)} * or {@link #finish} to specify an explicit transition animation to * perform next. * *转载 2015-01-06 14:07:57 · 839 阅读 · 0 评论 -
android 状态栏、标题栏、屏幕高度
From: http://xqjay19910131-yahoo-cn.iteye.com/blog/14352491.获取状态栏高度: decorView是window中的最顶层view,可以从window中获取到decorView,然后decorView有个getWindowVisibleDisplayFrame方法可以获取到程序显示的区域,包括标题栏,但不包括状态栏。于是转载 2015-02-04 15:25:14 · 528 阅读 · 0 评论 -
android 应用退到后台,类似最小化
From: http://blog.youkuaiyun.com/cool_ping/article/details/8237995在activity中调用 moveTaskToBack (boolean nonRoot)方法即可将activity 退到后台,注意不是finish()退出。参数为false代表只有当前activity是task根,指应用启动的第一个activity时,才有效;转载 2015-01-19 18:03:23 · 768 阅读 · 0 评论 -
Android Kill Process
From: http://developer.android.com/guide/components/activities.htmlThe column labeled "Killable after?" indicates whether or not the system can kill the process hosting the activity at any time af转载 2014-12-30 10:46:12 · 647 阅读 · 0 评论 -
Coordinating activities
From: http://developer.android.com/guide/components/activities.htmlWhen one activity starts another, they both experience lifecycle transitions. The first activity pauses and stops (though, it won转载 2014-12-30 10:56:16 · 436 阅读 · 0 评论 -
android.intent.action.MAIN 与 android.intent.category.LAUNCHER 的验证理解
From: http://blog.chinaunix.net/uid-26435987-id-3209050.html第一种情况:有MAIN,无LAUNCHER,程序列表中无图标原因:android.intent.category.LAUNCHER决定应用程序是否显示在程序列表里 第二种情况:无MAIN,有LAUNCHER,程序列表中无图标原因:android.intent.转载 2014-12-30 15:03:15 · 605 阅读 · 0 评论 -
Visiblity 和 AttachToWindow 无关性
简单Test了一下, 一个View的Visiblity是什么并不会导致其attahTo/detachFrom 一个 window.原创 2014-12-31 17:42:42 · 897 阅读 · 0 评论 -
overridePendingTransition
/** * Call immediately after one of the flavors of {@link #startActivity(Intent)} * or {@link #finish} to specify an explicit transition animation to * perform next. * * As of原创 2015-01-19 18:16:01 · 652 阅读 · 0 评论 -
onAttachToWindow() 调用
基于4.4 src:View的onAttachToWindow() 是在其dispatchAttachedToWindow(AttachInfo info, int visibility)里被无条件调用的,而View的dispatchAttachedToWindow()有两个被调用途径:1. ViewRootImpl 第一次 performTraversal()时会将整个view tr原创 2014-12-15 14:57:15 · 7695 阅读 · 1 评论 -
Android Activity getCurrentFocus()
/** * Calls {@link android.view.Window#getCurrentFocus} on the * Window of this Activity to return the currently focused view. * * @return View The current View with focus or转载 2015-02-12 14:50:07 · 4705 阅读 · 1 评论