初次使用本博客,了解一下其编辑器的对内容的表现方式。
1. 基本标签
delete
Itatic
Strong
underline
2.列表
- 对activity不要做长时间(long-lived)引用
- 试着用application替代activity,因为前者生命周期更长
- 如果不打算控制内置类的生命周期,使用静态内置类,并弱(weak)引用外部类
- GC无法防止内存泄漏
3.还是列表
- Activity生命周期:
- onCreate(Bundle) 当被创建时
- onRestart()重新加载时,
- onStart()当其可见时,
- onResume()能获得用户焦点时,
- onPause()发生切换时,
- onStop()不再可见时,
- onDestroy()销毁时。
4.代码
java代码
1 public static void prepareUserAgent(Context context) {
2 try {
3 // Read package name and version number from manifest
4 PackageManager manager = context.getPackageManager();
5 PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
6 sUserAgent = String.format(context.getString(R.string.template_user_agent),
7 info.packageName, info.versionName);
8
9 } catch(NameNotFoundException e) {
10 Log.e(TAG, "Couldn't find package information in PackageManager", e);
11 }
12 }
C++代码
const TSize buttonSize( aRect.Size() );
const TSize imageSize( iBmp->SizeInPixels() );
// Put the image in the middle of the button.
const TPoint imagePos( (buttonSize.iWidth - imageSize.iWidth) / 2,
(buttonSize.iHeight - imageSize.iHeight) / 2 );
浙公网安备 33010602011771号