引用:http://3387980.blog.51cto.com/3377980/982784

启动activity源码:(记得要加上Intent.FLAG_ACTIVITY_NEW_TASK)

        
  1. Intentintent=newIntent();
  2. intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  3. intent.setClass(getApplicationContext(),FileBrowserActivity.class);
  4. startActivity(intent);

启动alertDialog源码:

            
  1. AlertDialog.Builderbuilder=newAlertDialog.Builder(this);
  2. builder.setMessage("是否接受文件?")
  3. .setPositiveButton("是",newDialogInterface.OnClickListener(){
  4. @Override
  5. publicvoidonClick(DialogInterfacedialog,intwhich){
  6. }
  7. }).setNegativeButton("否",newOnClickListener(){
  8. @Override
  9. publicvoidonClick(DialogInterfacedialog,intwhich){
  10. }
  11. });
  12. AlertDialogad=builder.create();
  13. //ad.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);//系统中关机对话框就是这个属性
  14. ad.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
  15. ad.setCanceledOnTouchOutside(false);//点击外面区域不会让dialog消失
  16. ad.show();
还要加上权限
            
  1. <uses-permissionandroid:name="android.permission.SYSTEM_ALERT_WINDOW"/>

更多相关文章

  1. android 简单的aidl
  2. 为android编译ffmpeg+x264+faac
  3. android Manifest 一些属性
  4. Android之复选框对话框用法实例分析
  5. [Android]Http通信,HttpService服务端通过getEntity获取HttpClien
  6. Android点击返回按钮弹出确认消息对话框
  7. ERROR: All flavors must now belong to a named flavor dimensi
  8. Android的消息框处理方法
  9. Android(安卓)中自定义属性(attr.xml,TypedArray)的使用

随机推荐

  1. Windows下git下载android source
  2. android ndk 使用第三方静态库
  3. 【android】checkedTextView形成自定义Li
  4. Android(安卓)API 中文 (55) —— ListAdap
  5. 疯狂android讲义学习总结---TextView
  6. 加速 Android(安卓)开发的五大开源网站
  7. Android界面开发推荐颜色
  8. Android(安卓)EventBus的使用
  9. Android(安卓)SQLite Shell
  10. Android(安卓)AppWidget系统框架