Android 在launcher中创建实时文件夹【安卓进化三十三】
来源:互联网 发布:根据mac查ip 编辑:程序博客网 时间:2024/04/28 22:44
最近看了launcher方面的知识。在launcher中,选择文件夹选项后,选择“大明通讯录”就在主界面的launcher中创建了个实时文件夹,能调出联系人的姓名来,然后我们可以对其进行处理,点击进入手机号码的内容,然后可以打电话操作等等其他的操作!说明一下:实时文件夹显示有两种方式,一种是列表形式:DISPLAY_MODE_LIST。令一种是宫格的形式:DISPLAY_MODE_GRID。别忘了在Manifest.xml中注册一下:
<intent-filter> <action android:name="android.intent.action.CREATE_LIVE_FOLDER"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter>
转载请标明出处:http://blog.csdn.net/wdaming1986/article/details/6878873
下面看效果图:
长按主菜单屏幕弹出这个对话框: 点击大明通讯录选项:
主界面多了个通讯录的实时文件夹: 以list形式显示通讯录的内容:
以grid形式显示通讯录的内容:
下面看代码:TempFileWidget程序:
一、在com.cn.daming的包下面的TempFileWidgetMainActivity.java类中的代码:
package com.cn.daming;import android.app.Activity;import android.content.Intent;import android.net.Uri;import android.os.Bundle;import android.provider.ContactsContract;import android.provider.LiveFolders;import android.widget.Toast;public class TempFileWidgetMainActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //charge the floder is refresh floder or not if(getIntent().getAction().equals(LiveFolders.ACTION_CREATE_LIVE_FOLDER)){Intent mIntent = new Intent();mIntent.setData(Uri.parse("content://contacts/live_folders/people"));new Intent(Intent.ACTION_VIEW,ContactsContract.Contacts.CONTENT_URI);mIntent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_NAME, "通讯录");mIntent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_ICON,Intent.ShortcutIconResource.fromContext(this, R.drawable.contacts));//list modemIntent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_DISPLAY_MODE, LiveFolders.DISPLAY_MODE_LIST);//grid mode//mIntent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_DISPLAY_MODE, LiveFolders.DISPLAY_MODE_GRID);setResult(RESULT_OK, mIntent);}else{setResult(RESULT_CANCELED);} finish(); }}
二、在AndroidManifest.xml中的代码:
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.cn.daming" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="8" /> <application android:icon="@drawable/contacts" android:label="@string/app_name"> <activity android:name=".TempFileWidgetMainActivity" android:label="@string/app_name"> <!-- add the contacts widget launcher --> <intent-filter> <action android:name="android.intent.action.CREATE_LIVE_FOLDER"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application></manifest>
三、values包下string中的代码:
<?xml version="1.0" encoding="utf-8"?><resources> <string name="hello">Hello World, TempFileWidgetMainActivity!</string> <string name="app_name">大明通讯录</string></resources>
- Android 在launcher中创建实时文件夹【安卓进化三十三】
- Android中源码Launcher主屏幕程序排列详解【安卓Launcher进化一】
- Android中源码Launcher主屏幕程序排列详解【安卓Launcher进化一】
- Android中源码Launcher主屏幕程序排列详解【安卓Launcher进化一】
- Android中源码Launcher主屏幕程序排列详解【安卓Launcher进化一】
- Android中源码Launcher主屏幕程序排列详解【安卓Launcher进化一】
- Android中源码Launcher主屏幕程序排列详解【安卓Launcher进化一】
- Android中源码Launcher主屏幕程序排列详解【安卓Launcher进化一】
- Android中程序向桌面和Launcher添加快捷方式【安卓进化三十二】
- 安卓实现实时文件夹的创建
- android 安卓创建文件夹
- android 创建实时文件夹
- Android中Message传递参数【安卓进化十六】
- Android中ContentProvider简介【安卓进化二十七】
- Android中File形式保存数据【安卓进化三十】
- Android中SlidingDrawer介绍【安卓进化三十四】
- Android中Message传递参数【安卓进化十六】
- Android Launcher开发(一)LiveFolder(实时文件夹) 完全解析
- code自定义的Drawable
- 办公室琐事--沟通、交流
- Strassen矩阵乘法
- 整理的 英文 c/c++ 编程 wiki
- 【转载】关于Python混合编程时的内存泄露
- Android 在launcher中创建实时文件夹【安卓进化三十三】
- fluent 并行版的 Scheme 问题
- Monte Carlo Simulation
- 随机算法
- 私有ip
- 蓄水池抽样
- 如何kill掉RMAN备份进程
- C中各类型的长度
- 移动互联网中用户需求