Android平台下的一些常用知识
2014-04-18 13:57
423 查看
安装某个应用
Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File("/sdcard/XXX.apk")), "application/vnd.android.package-archive");
把一个字符串写进文件
String str = "goodgoodstudy,daydayup";File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(),"字符串.txt");
FileOutputStream out=new FileOutputStream(file,true);
byte[] bytes = str.getBytes() ;
out.write(bytes);
out.close() ;
把文件内容读出到一个字符串
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(),"字符串.txt");FileInputStream in = new FileInputStream(file);
int length = (int) file.length();
byte[] tmp = new byte[length];
in.read(tmp, 0, length);
String str = new String(tmp);
Toast.makeText(act, str, 0).show();
模拟HOME按键
Intent intent = new Intent(Intent.ACTION_MAIN);intent.addCategory(Intent.CATEGORY_HOME);
intent.addFlags
4000
(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
相关文章推荐
- android开发中常用的一些集成开放平台(持续更新)
- Android平台上开发网络应用的一些常用接口。
- Android一些常用知识和代码(不断更新)
- Android一些常用知识和代码(不断…
- Android平台的一些常用命令
- android 中ListView中的一些常用设置
- android将String转化为MD5的方法+一些String常用的方法
- Android平台移植ffmpeg的一些笔记
- c++常用知识的一些博文地址
- Android应用调试常用知识(2)
- ANDROID中一些常用的Activity子类
- android 数据库 联系人数据的一些常用URI
- DIV+CSS网页布局常用的一些基础知识整理
- 【Android】【Other】Android一些常用命令
- 对google的android的平台的一些看法。
- 关于Iphone开发得一些案例及常用知识(转过来的参考用)
- Android 中一些常用而又容易忘记的
- Android——一些常用的自定义View
- Android平台调用so库中函数的流程及一些坑
- 【综合】JAVA、android中常用的一些jar包的作用,您知道多少?