This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension("txt"); | |
| if (mime == null) { | |
| mime = "application/octet-stream"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ActivityManager am = ((ActivityManager)mAppContext.getSystemService(Context.ACTIVITY_SERVICE)); | |
| List<ActivityManager.RunningAppProcessInfo> processInfos = am.getRunningAppProcesses(); | |
| String mainProcessName = mAppContext.getPackageName(); | |
| int myPid = Process.myPid(); | |
| for (ActivityManager.RunningAppProcessInfo info : processInfos) { | |
| if (info.pid == myPid && mainProcessName.equals(info.processName)) { | |
| return true; | |
| } | |
| } | |
| return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static void scaleImage(final Activity activity, final View view, int drawableResId) { | |
| // 获取屏幕的高宽 | |
| Point outSize = new Point(); | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { | |
| activity.getWindow().getWindowManager().getDefaultDisplay().getSize(outSize); | |
| } else { | |
| outSize.x = activity.getWindow().getWindowManager().getDefaultDisplay().getWidth(); | |
| outSize.y = activity.getWindow().getWindowManager().getDefaultDisplay().getHeight(); | |
| } |
NewerOlder