http://stackoverflow.com/a/36027375
resolve this by downgrading buildToolsVersion in app gradle setting: changing this line:
buildToolsVersion "24.0.0 rc1"
to
buildToolsVersion "23.0.2"
buildToolsVersion "24.0.0 rc1"
buildToolsVersion "23.0.2"
Resources
for the way most applications will want to retrieve their resource data. This class presents a lower-level API that allows you to open and read raw files that have been bundled with the application as a simple stream of bytes.Parameters | |
---|---|
pkg | String : The name of the package that the component exists in. Can not be null. |
cls | String : The name of the class inside of pkg that implements the component. Can not be null. |
Parameters | |
---|---|
pkg | Context : A Context for the package implementing the component, from which the actual package name will be retrieved. |
cls | String : The name of the class inside of pkg that implements the component. |
Parameters | |
---|---|
pkg | Context : A Context for the package implementing the component, from which the actual package name will be retrieved. |
cls | Class : The Class object of the desired component, from which the actual class name will be retrieved. |
public boolean isIntentAvailable(Context context, String action) { final PackageManager packageManager = context.getPackageManager(); final Intent intent = new Intent(action); List<ResolveInfo> resolveInfo = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); if (resolveInfo.size() > 0) { return true; } return false; }
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
private void loadApps() { Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); mApps = getPackageManager().queryIntentActivities(mainIntent, 0); }
setApplicationEnabledSetting(String, int, int)
and setComponentEnabledSetting(ComponentName, int, int)
: This component or application is in its default enabled state (as specified in its manifest).CATEGORY_DEFAULT
will be considered for matching. This is a synonym for including the CATEGORY_DEFAULT in your supplied Intent.Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add the statistics from the right
UsageStats to the left. | |||||||||||
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
| |||||||||||
Get the beginning of the time range this
UsageStats represents, measured in milliseconds since the epoch. | |||||||||||
Get the end of the time range this
UsageStats represents, measured in milliseconds since the epoch. | |||||||||||
Get the last time this package was used, measured in milliseconds since the epoch.
| |||||||||||
Get the total time this package spent in the foreground, measured in milliseconds.
| |||||||||||
Flatten this object in to a Parcel.
|
1.res -> right click -> New -> Vector Assert |
2-1.可透過"Choose"選擇內建的PNG檔。 2-2.或是點選Local SVG file,指定PNG檔。 |
3.在這以指定的PNG檔作示範 |
ActivityManager mActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE) ; //獲得系統運行的process List<ActivityManager.RunningAppProcessInfo> appList1 = mActivityManager.getRunningAppProcesses(); for (RunningAppProcessInfo running : appList1) { System.out.println(running.processName); } System.out.println("================"); //獲得當前正在運行的service List<ActivityManager.RunningServiceInfo> appList2 = mActivityManager.getRunningServices(100); for (ActivityManager.RunningServiceInfo running : appList2) { System.out.println(running.service.getClassName()); } System.out.println("================"); //獲得當前正在運行的activity List<ActivityManager.RunningTaskInfo> appList3 = mActivityManager.getRunningTasks(1000); for (ActivityManager.RunningTaskInfo running : appList3) { System.out.println(running.baseActivity.getClassName()); } System.out.println("================"); //獲得最近運行的應用 List<ActivityManager.RecentTaskInfo> appList4 = mActivityManager.getRecentTasks(100, 1); for (ActivityManager.RecentTaskInfo running : appList4) { System.out.println(running.origActivity.getClassName()); }
===================================================================