摘要:View vFocus=getWindow().getDecorView().findFocus(); if(vFocus instanceof EditText){ ((EditText) vFocus).setText("当前焦点");}
阅读全文
摘要:1 public void openApp(String packageName, Context context) { 2 PackageManager packageManager = context.getPackageManager(); 3 Int...
阅读全文
摘要:1 /** 2 * 安装apk 3 * 4 * @param url 5 */ 6 private void installApk() { 7 File apkfile = new File(apkFilePath); 8 ...
阅读全文
摘要:1 public static final int FLAG_HOMEKEY_DISPATCHED = 0x80000000; 2 3 @Override 4 protected void onCreate(Bundle savedInstanceState) { 5 s...
阅读全文
摘要:1 public class Main4Activity extends Activity { 2 3 private TextView tv1; 4 private Button button1; 5 private RelativeLayout rlMain...
阅读全文
摘要:1 @Override 2 protected void onCreate(Bundle savedInstanceState) { 3 super.onCreate(savedInstanceState); 4 setContentView(R.layou...
阅读全文
摘要:1 /** 2 * 获取父控件的位置y-popwindow的高度 = 应该显示的y坐标. x这里设置为center 不刻意指定坐标 注意:控件坐标永远是 左上角坐标! 3 * 4 * @param parent 5 */ 6 public v...
阅读全文
摘要:PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); boolean screen = pm.isScreenOn();
阅读全文
摘要:1 Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); 2 Uri uri = Uri.fromFile(new File("/sdcard/image.jpg")); 3 intent.setData(uri); 4...
阅读全文