WindowManager wm = ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE));


Cursor cursor = getContentResolver().query(People.CONTENT_URI, null, null, null, null); 

解释:Cursor cursor = getContentResolver().query(People.CONTENT_URI, null, null, null, null);先获得一个指向系统通讯录数据库的Cursor对象获得数据来源。



startManagingCursor(cursor); 

解释:This method allows the activity to take care of managing the given Cursor's lifecycle for you based on the activity's lifecycle. That is, when the activity is stopped it will automatically call deactivate() on the given Cursor, and when it is later restarted it will call requery() for you. When the activity is destroyed, all managed Cursors will be closed automatically.
startManagingCursor(cursor);我们将获得的Cursor对象交由Activity管理,这样Cursor的生命周期和Activity便能够自动同步,省去自己手动管理Cursor。



newfs_msdos /dev/block/mmcblk3p2
清数据


ListAdapter listAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_expandable_list_item_1,                 cursor,                new String[]{People.NAME},                 new int[]{android.R.id.text1});  

解释:SimpleCursorAdapter 构造函数前面3个参数和ArrayAdapter是一样的,最后两个参数:一个包含数据库的列的String型数组,一个包含布局文件中对应组件id的int型数组。其作用是自动的将String型数组所表示的每一列数据映射到布局文件对应id的组件上。上面的代码,将NAME列的数据一次映射到布局文件的id为text1的组件上。


mTextViews[1].setTextAppearance(mContext,android.R.attr.textAppearanceSmall)

解释: 引用 Text color, typeface, size, and style for "small" text.

public static final int textAppearanceSmall
Since: API Level 1

Text color, typeface, size, and style for "small" text. Defaults to secondary text color.

Must be a reference to another resource, in the form "@[+][package:]type:name" or to a theme attribute in the form "?[package:][type:]name".
Constant Value: 16842818 (0x01010042)

详见:
http://androidappdocs.appspot.com/reference/android/R.attr.html


动态添加perssion:
引用 权限树(permission-tree)
权限树的设置是为了统一管理一组权限,声明于该树下的权限所有者归属该应用。系统提供了API,应用可以在运行时动态添加。
 PackageManager.addPermission()

得到PackageName的方式:
1
ActivityManager mActivityManager;List<ActivityManager.RunningServiceInfo> mList;mActivityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);mList = mActivityManager.getRunningServices(20);for(ActivityManager.RunningServiceInfo am : mList) {    datas.add(am.service.getPackageName());    }

2
intent.getComponent().getPackageName()


3
am.baseActivity.getPackageName()

Android之零碎记忆点

killBackgroundProcesses
ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);   am.killBackgroundProcesses("cn.com.android123.cwj"); 



 ActivityManager.RunningAppProcessInfo runinfo

pm = ctx.getApplicationContext().getPackageManager()


http://t.baidu.com/guide/avatar


清数据
newfs_msdos /dev/block/mmcblk3p2


【让本view位于父view的横向中间】
android:layout_gravity="center_horizontal"

更多相关文章

  1. Android 数据库SQLite的操作总结
  2. Android中利用Intent传递数据到另一个页面
  3. android 如何从sqlite读取数据到spinner下拉中显示
  4. android中的Sqlite数据库操作
  5. Android用surface直接显示yuv数据
  6. 【Android】HTTP请求远端String和byte[]数据
  7. Android 通过http协议数据交互

随机推荐

  1. 一个Google Play的开发者,要了解的一些小
  2. Android跨进程通信AIDL详解(附源码)
  3. [Android进阶]Android中使用的观察者模式
  4. Android常用工具使用
  5. Android多网卡
  6. Android 开发者的 Flutter(五) —— Flutte
  7. 《论Android的发展方向(个人见解)》
  8. 【Android】Content Provider基础之SQL
  9. AndroidManifest.xml详解
  10. 深入浅出Android Gradle构建系统(三:buil