Skip to content

Instantly share code, notes, and snippets.

View cinohub's full-sized avatar

godfather cinohub

  • Freelancer
View GitHub Profile
@cinohub
cinohub / Application.java
Created July 24, 2016 17:33
Application
public class Application {
private String mName;
private String mPackage;
private Drawable mIcon;
private boolean isChecked;
public boolean isChecked() {
return isChecked;
}
@cinohub
cinohub / list.java
Last active July 25, 2016 05:25
Get list installed app
private List<Application> getInstalledAppList() {
List<Application> listApps = new ArrayList<>();
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List pkgAppsList = getPackageManager().queryIntentActivities(mainIntent, 0);
// Them vao list
for (Object object : pkgAppsList) {
ResolveInfo info = (ResolveInfo) object;
Drawable icon = getBaseContext().getPackageManager().getApplicationIcon(info.activityInfo.applicationInfo);
String strPackageName = info.activityInfo.applicationInfo.packageName.toString();
@cinohub
cinohub / gist:4f6e92115151d06f54e9c732b424562a
Created July 24, 2016 17:28
Get list installed app in android
private List<Application> getInstalledAppList() {
List<Application> listApps = new ArrayList<>();
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List pkgAppsList = getPackageManager().queryIntentActivities(mainIntent, 0);
ResolveInfoComparator resolveInfoComparator = new ResolveInfoComparator(getPackageManager());
Collections.sort(pkgAppsList, resolveInfoComparator);
String[] listPackageChecked = SharedPref.getInstance(getBaseContext()).getString(Constants.LIST_APP, "").split(getApplicationContext()
.getString(R.string.signal));
for (Object object : pkgAppsList) {