首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

转:Android 学习四

2012-09-28 
转:Android 学习4转载自:http://www.cnblogs.com/mengshu-lbq/archive/2010/08/27/1810271.html1 打开内置

转:Android 学习4

转载自:http://www.cnblogs.com/mengshu-lbq/archive/2010/08/27/1810271.html

1 打开内置的APK Installer来安装APK(需要将Application Setting中的Unknown sources打开)

?

Intent intent = new Intent();intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);intent.setAction(android.content.intent.ACTION_VIEW);FILE f = new File(apkFileName);//need android.permission.INSTALL_PACKAGESintent.setDataAndType(Uri.from(f),"application/vnd.android.package-archive");startActivity(intent);
?

卸载程序

?

Uri packageURI = Uri.parse("package:com.android.myapp");     Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);     startActivity(uninstallIntent);

?2 判断设备是否有存储卡

?

import static android.os.Environment.*;
?boolean existSDCard = false;
if(getExternalStorageState().equals(MEDIA_MOUNTED))     existSDCard = true;

?3 全屏显示

?

//必须在setContentView之前调用全屏显示requestWindowFeature(Window.FEATURE_NO_TITLE);getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

?setContentView(R.layout.main);

热点排行