读书人

android 开发中的1些小知识点

发布时间: 2013-11-08 17:52:01 作者: rapoo

android 开发中的一些小知识点

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

android.app.NotificationManager

?

这个类用一下几种方式来告诉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可以作很多操作,但是最主要的??? Handy class for starting a new thread that has a looper.

读书人网 >Android

热点推荐