Android之创建实时文件夹
2012-04-28 15:18
288 查看
以下使用的是SDK自带的例子来进行分析:
首先,需要在 AndroidManifest.xml中添加<action android:name= "android.intent.action.CREATE_LIVE_FOLDER" />
然后如下分析:
首先,需要在 AndroidManifest.xml中添加<action android:name= "android.intent.action.CREATE_LIVE_FOLDER" />
然后如下分析:
public class MyLiveFolder extends Activity { public static final Uri CONTENT_URI = Uri.parse("content://my.app/live"); protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //获得Intent final Intent intent = getIntent(); //获得在AndroidManifest中设定的action final String action = intent.getAction(); //判定 if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equals(action)) { setResult(RESULT_OK, createLiveFolder(this, CONTENT_URI, "My LiveFolder", R.drawable.ic_launcher_contacts_phones)); } else { setResult(RESULT_CANCELED); } finish(); } private static Intent createLiveFolder(Context context, Uri uri, String name, int icon) { final Intent intent = new Intent(); //设置数据地址 intent.setData(uri); //设置实时文件夹的名字 intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_NAME, name); //设置实时文件夹的图片 intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_ICON, Intent.ShortcutIconResource.fromContext(context, icon)); //设置实时文件夹得显示模式,一种是列表模式,另一种是类型于九宫格的模式 intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_DISPLAY_MODE, LiveFolders.DISPLAY_MODE_LIST); return intent; } }
相关文章推荐
- android 创建实时文件夹
- Android 在launcher中创建实时文件夹【安卓进化三十三】
- android 创建实时文件夹
- Android实时文件夹创建方法
- android创建和删除文件夹和文件的实现方法
- Android Launcher开发(一)LiveFolder(实时文件夹) 完全解析
- Android之实时文件夹
- android 创建文件夹和文件
- Android适配文件夹的创建
- android sdcard下创建文件夹
- android创建文件夹和文件
- Android 实时文件夹
- Android创建文件夹
- 【android学习之十七】——特色功能2:桌面组件(快捷方式,实时文件夹)
- Android 初始文件夹创建 以及 文件&文件夹相关操作
- android下创建文件夹和修改其权限的方法
- Android 下如何创建文件夹在SD卡中
- Android创建和删除文件夹和文件
- Android桌面组件开发之实时文件夹(Live_Folders)
- Android中文件与文件夹的创建(file)