//去掉窗口标题栏
requestWindowFeature(Window.FEATURE_NO_TITLE);
//全屏显示
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
//返回系统Home桌面
Intent intent = new Intent();
//设置Action和Category属性
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
startActivity(intent);//创建Tab
TabHost tabhost = getTabHost();
tabhost.addTab(tabhost.newTabSpec("tab1").setIndicator("已接电话"/*),getResources().getDrawable(R.drawable.icon)*/.setContent(new Intent(this,newACtivity.class)));
//获取当前app的手机内存位置
// /data/data/包名/files
File file = new File(context.getFiledir(),"info.txt");
//缓存位置
// /data/data/包名/cache
getCacheDir()
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
String data = "http://www.baidu.com":
//解析字符串为Uri对象
Uri uri = Uri.parse(data);
intent.setData(uri);
//启动要访问的浏览器页面
startActivity(intent);
//通过窗口管理器获取屏幕的宽高
WindowManager mWManger = getWindowManager();
Display display = mWManger.getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
//display.getWidth();display.getHeight();已弃用
//获取屏幕宽高
tableWidth = metrics.widthPixels;
tableHeight = metrics.heightPixels;//读写SD卡上的文件的步骤:
(1)、调用Environment的getExternalStorageState()方法判断手机上是否插入了SD卡,并且应用程序具有读写SD卡的权限。
//如果手机插入了SD卡,并且具有读写SD卡的权限,返回true
Environtment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);(2)、调用Environment的getExternalStorageDirectory()方法来获取外部存储器,也就是SD卡的目录。
(3)、使用FIleInputStream、FileOutputStream、FileReader或FileWriter读写、写SD卡里的文件。
读写SD卡的权限:
<!-- 在SD卡中创建与删除文件权限 -->
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<!-- 向SD卡中写入数据权限 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
7289

被折叠的 条评论
为什么被折叠?



