- 浏览: 46458 次
- 性别:
- 来自: 西安
最新评论
1 关于onPause():
onPause() is always called when the Activity ends, even if we
instigated that (with a finish() call for example). We will use this to save the current data back to the database. Good practice is to release any resources that can be released during an onPause()
as well, to take up less resources when in the passive state。
2 关于onSaveInstanceState();
There is no guarantee that onSaveInstanceState()
will be called and because when it is called, it is called before onPause()
.
3关于 assets: Files in assets/
are not given a resource ID, so you can read them only using AssetManager
4
这个类用一下几种方式来告诉user 在device的 background发生了些什么事情
A persistent icon that goes in the status bar and is accessible through the launcher, (when the user selects it, a designated Intent can be launched),
- Turning on or flashing LEDs on the device, or
- Alerting the user by flashing the backlight, playing a sound, or vibrating.
每一个notify methods会以一个int 型的id 作为参数。这个id是作为notification唯一的标识(因为系统中会有很多的notification),当你用同样的id调用一个notify methods
的时候,相当于更新这个notification。你可以通过getSystemService(String)获得一个android.app.NotificationManager的实例对象
5在android中context可以作很多操作,但是最主要的功能 是加载 和访问资源 。在android中有两种context,一种是 application context,一种是activity context,
通常我们在各种类和方法间传递的是activity context。
比如一个activity的onCreate:
protected void onCreate(Bundle state) {
super.onCreate(state);
TextView label = new TextView(this); //传递context给view control
label.setText("Leaks are bad");
setContentView(label);
}
把activity context传递给view,意味着view拥有一个指向activity的引用,进而引用activity占有的资源:view hierachy, resource等。
5 Intent 与 pendingIntent的区别
intent英文意思是意图,pending表示即将发生或来临的事情。
PendingIntent这个类用于处理即将发生的事情。比如在通知Notification中用于跳转页面,但不是马上跳转。
Intent 是及时启动,intent 随所在的activity 消失而消失。
PendingIntent 可以看作是对intent的包装,通常通过getActivity,getBroadcast ,getService来得到pendingintent的实例,当前activity并不能马上启动它所包含的intent,而是在外部执行 pendingintent时,调用intent的。正由于pendingintent中 保存有当前App的Context,使它赋予外部App一种能力,使得外部App可以如同当前App一样的执行pendingintent里的 Intent, 就算在执行时当前App已经不存在了,也能通过存在pendingintent里的Context照样执行Intent。另外还可以处理intent执行后的操作。常和alermanger 和notificationmanager一起使用。
Intent一般是用作Activity、Sercvice、BroadcastReceiver之间传递数据,而Pendingintent,一般用在 Notification上,可以理解为延迟执行的intent,PendingIntent是对Intent一个包装。
6 RemoteViews 就是一个可以显示在其它进程中对象
7 (1)Service生命周期只有onCreate, onStart和onDestroy,没有onResume, onPause和onStop 。如果你在onCreate或onStart做一些很耗时间的事情,最好启动一个线程来完成,因为如果Service是跑在主线程中的,会影响到你的UI操作或者阻塞主线程中的其他事情。BroadcastReceiver只能通过startService启动Service ,因为广播本身生命周期很短,bind的话没有意义\
8 HandlerThread
Handy class for starting a new thread that has a looper.
发表评论
-
Android Intent and Intent Filter (转)
2011-03-10 22:47 1425Android Intent and Intent ... -
Intent详解
2011-03-03 14:18 1115在应用中,我们可以以两种形式来使用Intent: 直接I ... -
Intent间传送数据一般有两种常用方法
2011-01-24 14:50 1267Intent间传送数据一般有两种常用的办法: 1.extra ... -
android RelativeLayout 详解
2011-01-01 09:46 1559<?xml version="1.0" ... -
How to Use Android Downloads Provider
2010-12-20 21:41 1306本文转载自 http://blog.lytsing.or ... -
content provider 深入解析
2010-12-15 22:04 1067Content providers are on ... -
Service的高级应用
2010-12-12 20:48 1319下面是android Service的高级应用的一个例子,主要 ... -
TabActivity
2010-12-12 19:09 1731下面是一个使用android tabactivity 的例子 ... -
android 测试初探(android test)
2010-12-07 15:00 7982android Testing and Instrumenta ... -
Localization of android
2010-12-05 21:51 0android 会在不同地域的不同机器上运行。为了是应用能够 ... -
android高效编程之使用本地变量
2010-12-05 14:26 948hava a look at the following co ... -
在不同的Activity中传递对象的方法
2010-12-02 10:20 1977下面我们将要实现的功 ... -
Cursor与Adapter
2010-11-21 08:34 1201来自: http://hi.baidu.com/lfcaoli ... -
Working with Context Menus
2010-11-15 23:36 828... -
Handler的理解
2010-11-14 20:58 799A Handler allows you to sen ... -
android开发问题解决日志
2010-11-14 18:33 18451.、android中R文件消失的处理方式 ... -
android 中对SDCard 的操作
2010-11-11 14:14 1598对于像视频这样的大文件,我们可以把它存放在SDCard。 SD ... -
ViewAnimation
2010-11-05 12:46 1010view animation 的实现 Understandi ... -
android高效的编写高效代码
2010-10-17 19:13 728本文来源于: 从此学习网 原文: http://www.con ... -
scale animation
2010-10-11 23:29 1582Scale animation: You use this t ...
相关推荐
Android开发网上的一些重要知识点,Android开发网上的一些重要知识点
个人总结的一些android开发基础知识,希望对你有所帮助。
android 安卓开发 app 移动开发 程序员 android面试题整理 android开发工程师必备资料文档
Android开发核心知识点笔记 涵盖了以下七大板块的知识点: 1、Java知识点汇总 2、Android知识点汇总 3、Android扩展知识点 4、Android开源库源码分析 5、设计模式汇总 6、Gradle知识点汇总 7、常见面试算法题汇总
android开发知识点大全,知识点+示例代码,帮助你很快掌握android开发的各种基础技能,
2023年Android开发一些重要知识点.doc
Android开发一些重要知识点.doc
Android开发一些重要知识点汇总.doc
第一,介绍Android开发者不容易掌握的一些知识点;第二,结合Android源代码和应用层开发过程,融会贯通,介绍一些比较深入的知识点;第三,介绍一些核心技术和Android的性能优化思想。 《Android开发艺术探索》侧重...
由real6410公司提供的android开发笔记 针对real6410开发板,可迅速提高android开发 技能
Android开发各知识点总结,关于android开发的安全性问题的
Android开发知识点总结[参考].pdf
《Android开发艺术探索》是一本Android进阶类书籍,采用理论、源码和实践相结合的方式来阐述高水准的Android应用开发要点。...而对于高级开发者来说,仍然可以从《Android开发艺术探索》的知识体系中获益。
代码仅供初学者参考,对于有一定学习时长的入门者无参考价值,通过完整项目可体会到一些简单的应用开发思路和解决方法,涉及到一些简单的知识点,关于数据库,广播,内容接收者,服务,内容提供者等没有涉及。...
Android开发知识点详细介绍
Android核心知识点笔记
这里汇总了一些我认为比较有用的知识点、帖子。供大家共同学习复习。
android开发艺术探索超清版,...第一,介绍Android开发者不容易掌握的一些知识点;第二,结合Android源代码和应用层开发过程,融会贯通,介绍一些比较深入的知识点;第三,介绍一些核心技术和Android的性能优化思想。
Android_开发知识点,包含android开发的基础及应用的知识点介绍。