本文整理汇总了Java中android.util.ArrayMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayMap.get方法的具体用法?Java ArrayMap.get怎么用?Java ArrayMap.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.util.ArrayMap
的用法示例。
在下文中一共展示了ArrayMap.get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyConfigActivities
import android.util.ArrayMap; //导入方法依赖的package包/类
public static void applyConfigActivities(PackageManager pm, ArrayMap<String, AppRow> rows,
List<ResolveInfo> resolveInfos) {
if (DEBUG) Log.d(TAG, "Found " + resolveInfos.size() + " preference activities"
+ (resolveInfos.size() == 0 ? " ;_;" : ""));
for (ResolveInfo ri : resolveInfos) {
final ActivityInfo activityInfo = ri.activityInfo;
final ApplicationInfo appInfo = activityInfo.applicationInfo;
final AppRow row = rows.get(appInfo.packageName);
if (row == null) {
if (DEBUG) Log.v(TAG, "Ignoring notification preference activity ("
+ activityInfo.name + ") for unknown package "
+ activityInfo.packageName);
continue;
}
if (row.settingsIntent != null) {
if (DEBUG) Log.v(TAG, "Ignoring duplicate notification preference activity ("
+ activityInfo.name + ") for package "
+ activityInfo.packageName);
continue;
}
row.settingsIntent = new Intent(APP_NOTIFICATION_PREFS_CATEGORY_INTENT)
.setClassName(activityInfo.packageName, activityInfo.name);
}
}
示例2: addFilter
import android.util.ArrayMap; //导入方法依赖的package包/类
private final void addFilter(ArrayMap<String, F[]> map, String name, F filter) {
F[] array = map.get(name);
if (array == null) {
array = newArray(2);
map.put(name, array);
array[0] = filter;
} else {
final int N = array.length;
int i = N;
while (i > 0 && array[i-1] == null) {
i--;
}
if (i < N) {
array[i] = filter;
} else {
F[] newa = newArray((N*3)/2);
System.arraycopy(array, 0, newa, 0, N);
newa[N] = filter;
map.put(name, newa);
}
}
}
示例3: unZip
import android.util.ArrayMap; //导入方法依赖的package包/类
private void unZip(ZipInputStream zis, ArrayMap<String,File> files) throws FileExistsException, IOException {
ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {
String entryName=entry.getName();
File outFile=files.get(entryName);
if (entry.isDirectory()) {
outFile.mkdirs();
} else {
if (outFile != null) {
if (outFile.exists())
throw new FileExistsException(outFile);
if (!outFile.getParentFile().exists() && !outFile.getParentFile().mkdirs())
throw new IOException("can't mkdirs:" + outFile.getParent());
if (onUpdateListener != null)
onUpdateListener.onUpdate(entryName, outFile);
BufferedOutputStream dest = new BufferedOutputStream(new FileOutputStream(outFile), buffer.length);
int count;
while ((count = zis.read(buffer, 0, buffer.length)) != -1) {
dest.write(buffer, 0, count);
}
dest.flush();
dest.close();
}
}
}
}
示例4: remove_all_objects
import android.util.ArrayMap; //导入方法依赖的package包/类
private final void remove_all_objects(ArrayMap<String, F[]> map, String name,
Object object) {
F[] array = map.get(name);
if (array != null) {
int LAST = array.length-1;
while (LAST >= 0 && array[LAST] == null) {
LAST--;
}
for (int idx=LAST; idx>=0; idx--) {
if (array[idx] == object) {
final int remain = LAST - idx;
if (remain > 0) {
System.arraycopy(array, idx+1, array, idx, remain);
}
array[LAST] = null;
LAST--;
}
}
if (LAST < 0) {
map.remove(name);
} else if (LAST < (array.length/2)) {
F[] newa = newArray(LAST+2);
System.arraycopy(array, 0, newa, 0, LAST+1);
map.put(name, newa);
}
}
}
示例5: getValue
import android.util.ArrayMap; //导入方法依赖的package包/类
private <T> T getValue(ArrayMap<String, T> map) throws IOException {
String url = request.url().toString();
T value = map.get(url);
if (value == null) {
value = map.get(ANY_URL);
if (value == null) {
throw new IOException(String.format("Unhandled URL: [%s]", url));
}
}
return value;
}
示例6: remove_all_objects
import android.util.ArrayMap; //导入方法依赖的package包/类
private final void remove_all_objects(ArrayMap<String, F[]> map, String name,
Object object) {
F[] array = map.get(name);
if (array != null) {
int LAST = array.length-1;
while (LAST >= 0 && array[LAST] == null) {
LAST--;
}
for (int idx=LAST; idx>=0; idx--) {
if (array[idx] == object) {
final int remain = LAST - idx;
if (remain > 0) {
System.arraycopy(array, idx+1, array, idx, remain);
}
array[LAST] = null;
LAST--;
}
}
if (LAST < 0) {
map.remove(name);
} else if (LAST < (array.length/2)) {
F[] newa = newArray(LAST+2);
System.arraycopy(array, 0, newa, 0, LAST+1);
map.put(name, newa);
}
}
}
示例7: UsageStatsAdapter
import android.util.ArrayMap; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
UsageStatsAdapter() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_WEEK, -1);
System.out.println("**Today****cal.getTime()*****" + cal.getTime() + "***getTimeMillis()***" + cal.getTimeInMillis());
System.out.println("**Today**System.currentTimeMillis()**** " + System.currentTimeMillis());
//final List<UsageStats>
stats = mUsageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, cal.getTimeInMillis(), System.currentTimeMillis());
System.out.println("---------------------" + stats);
for (UsageStats usg : stats) {
/* System.out.println("***stats count "+stats.size());
System.out.println("********************");
System.out.println("" + usg.getPackageName());
// System.out.println("First time: " + usg.getFirstTimeStamp());*/
//System.out.println("Last time :" + usg.getLastTimeStamp());
// System.out.println("Total Time: " + usg.getTotalTimeInForeground());
//System.out.println(usg.getLastTimeUsed());
System.out.println("********************");
}
if (stats == null) {
return;
}
ArrayMap<String, UsageStats> map = new ArrayMap<>();
final int statCount = stats.size();
for (int i = 0; i < statCount; i++) {
final UsageStats pkgStats = stats.get(i);
// load application labels for each application
try {
ApplicationInfo appInfo = mPm.getApplicationInfo(pkgStats.getPackageName(), 0);
String label = appInfo.loadLabel(mPm).toString();
mAppLabelMap.put(pkgStats.getPackageName(), label);
UsageStats existingStats = map.get(pkgStats.getPackageName());
/*for(int j=0;j<getSavedApps.size();j++){
System.out.println("**********4");
System.out.println("*****getSavedApps.get(i)*****"+getSavedApps.get(i).toString());
System.out.println("*****pkgStats.getPackageName()*****"+pkgStats.getPackageName().toString());*/
if (getSavedApps.contains(pkgStats.getPackageName().toString())) {
//System.out.println("*** adding to map "+getSavedApps.get(j)+" & "+pkgStats.getPackageName());
if (existingStats == null) {
map.put(pkgStats.getPackageName(), pkgStats);
} else {
existingStats.add(pkgStats);
}
} else System.out.println("****no match found");
} catch (PackageManager.NameNotFoundException e) {
// This package may be gone.
}
}
mPackageStats.addAll(map.values());
// Sort list
mAppLabelComparator = new AppNameComparator(mAppLabelMap);
sortList();
}
示例8: UsageStatsAdapter
import android.util.ArrayMap; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
UsageStatsAdapter() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_WEEK, -1);
System.out.println("**Yday****cal.getTime()*****" + cal.getTime() + "***getTimeMillis()***" + cal.getTimeInMillis());
System.out.println("**Yday**System.currentTimeMillis()**** " + System.currentTimeMillis());
//final List<UsageStats>
stats = mUsageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_DAILY,
cal.getTimeInMillis(), System.currentTimeMillis());
//System.out.println("---------------------"+stats);
for (UsageStats usg : stats) {
// System.out.println("***stats count "+stats.size());
// System.out.println("********************");
// System.out.println("" + usg.getPackageName());
// System.out.println("First time: " + usg.getFirstTimeStamp());
// System.out.println("Last time :" + usg.getLastTimeStamp());
// System.out.println("Total Time: " + usg.getTotalTimeInForeground());
// System.out.println(usg.getLastTimeUsed());
// System.out.println("********************");
//mPieChart.addPieSlice(new PieModel("", usg.getTotalTimeInForeground(), Color.parseColor(color)));
}
//mPieChart.startAnimation();
if (stats == null) {
return;
}
ArrayMap<String, UsageStats> map = new ArrayMap<>();
final int statCount = stats.size();
for (int i = 0; i < statCount; i++) {
final UsageStats pkgStats = stats.get(i);
// load application labels for each application
try {
ApplicationInfo appInfo = mPm.getApplicationInfo(pkgStats.getPackageName(), 0);
String label = appInfo.loadLabel(mPm).toString();
mAppLabelMap.put(pkgStats.getPackageName(), label);
UsageStats existingStats = map.get(pkgStats.getPackageName());
/*for(int j=0;j<getSavedApps.size();j++){
System.out.println("**********4");
System.out.println("*****getSavedApps.get(i)*****"+getSavedApps.get(i).toString());
System.out.println("*****pkgStats.getPackageName()*****"+pkgStats.getPackageName().toString());*/
if (getSavedApps.contains(pkgStats.getPackageName().toString())) {
//System.out.println("*** adding to map "+getSavedApps.get(j)+" & "+pkgStats.getPackageName());
if (existingStats == null) {
map.put(pkgStats.getPackageName(), pkgStats);
} else {
existingStats.add(pkgStats);
}
} else System.out.println("****no match found");
//}
/*if (existingStats == null) {
map.put(pkgStats.getPackageName(), pkgStats);
} else {
existingStats.add(pkgStats);
}*/
} catch (PackageManager.NameNotFoundException e) {
// This package may be gone.
}
}
mPackageStats.addAll(map.values());
// Sort list
mAppLabelComparator = new AppNameComparator(mAppLabelMap);
sortList();
}
示例9: UsageStatsAdapter
import android.util.ArrayMap; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
UsageStatsAdapter() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, -5);
System.out.println("**Today****cal.getTime()*****" + cal.getTime() + "***getTimeMillis()***" + cal.getTimeInMillis());
System.out.println("**Today**System.currentTimeMillis()**** " + System.currentTimeMillis());
//final List<UsageStats>
stats = mUsageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_MONTHLY,
cal.getTimeInMillis(), System.currentTimeMillis());
System.out.println("---------------------" + stats);
for (UsageStats usg : stats) {
// System.out.println("***stats count "+stats.size());
// System.out.println("********************");
// System.out.println("" + usg.getPackageName());
// System.out.println("First time: " + usg.getFirstTimeStamp());
// System.out.println("Last time :" + usg.getLastTimeStamp());
// System.out.println("Total Time: " + usg.getTotalTimeInForeground());
// System.out.println(usg.getLastTimeUsed());
// System.out.println("********************");
//mPieChart.addPieSlice(new PieModel("", usg.getTotalTimeInForeground(), Color.parseColor(color)));
}
//mPieChart.startAnimation();
if (stats == null) {
return;
}
ArrayMap<String, UsageStats> map = new ArrayMap<>();
final int statCount = stats.size();
for (int i = 0; i < statCount; i++) {
final UsageStats pkgStats = stats.get(i);
// load application labels for each application
try {
ApplicationInfo appInfo = mPm.getApplicationInfo(pkgStats.getPackageName(), 0);
String label = appInfo.loadLabel(mPm).toString();
mAppLabelMap.put(pkgStats.getPackageName(), label);
UsageStats existingStats = map.get(pkgStats.getPackageName());
/*for(int j=0;j<getSavedApps.size();j++){
System.out.println("**********4");
System.out.println("*****getSavedApps.get(i)*****"+getSavedApps.get(i).toString());
System.out.println("*****pkgStats.getPackageName()*****"+pkgStats.getPackageName().toString());*/
if (getSavedApps.contains(pkgStats.getPackageName().toString())) {
//System.out.println("*** adding to map "+getSavedApps.get(j)+" & "+pkgStats.getPackageName());
if (existingStats == null) {
map.put(pkgStats.getPackageName(), pkgStats);
} else {
existingStats.add(pkgStats);
}
} else System.out.println("****no match found");
//}
/*if (existingStats == null) {
map.put(pkgStats.getPackageName(), pkgStats);
} else {
existingStats.add(pkgStats);
}*/
} catch (PackageManager.NameNotFoundException e) {
// This package may be gone.
}
}
mPackageStats.addAll(map.values());
// Sort list
//mAppLabelComparator = new AppNameComparator(mAppLabelMap);
//sortList();
}
示例10: UsageStatsAdapter
import android.util.ArrayMap; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
UsageStatsAdapter() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, -1);
//System.out.println("**Today****cal.getTime()*****" + cal.getTime() + "***getTimeMillis()***" + cal.getTimeInMillis());
//System.out.println("**Today**System.currentTimeMillis()**** " + System.currentTimeMillis());
//final List<UsageStats>
stats = mUsageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_DAILY,
cal.getTimeInMillis(), System.currentTimeMillis());
System.out.println("---------------------" + stats);
for (UsageStats usg : stats) {
/* System.out.println("***stats count "+stats.size());
System.out.println("********************");
System.out.println("" + usg.getPackageName());
// System.out.println("First time: " + usg.getFirstTimeStamp());*/
//System.out.println("Last time :" + usg.getLastTimeStamp());
// System.out.println("Total Time: " + usg.getTotalTimeInForeground());
//System.out.println(usg.getLastTimeUsed());
}
if (stats == null) {
return;
}
ArrayMap<String, UsageStats> map = new ArrayMap<>();
final int statCount = stats.size();
for (int i = 0; i < statCount; i++) {
final UsageStats pkgStats = stats.get(i);
// load application labels for each application
try {
ApplicationInfo appInfo = mPm.getApplicationInfo(pkgStats.getPackageName(), 0);
String label = appInfo.loadLabel(mPm).toString();
mAppLabelMap.put(pkgStats.getPackageName(), label);
UsageStats existingStats = map.get(pkgStats.getPackageName());
/*for(int j=0;j<getSavedApps.size();j++){
System.out.println("**********4");
System.out.println("*****getSavedApps.get(i)*****"+getSavedApps.get(i).toString());
System.out.println("*****pkgStats.getPackageName()*****"+pkgStats.getPackageName().toString());*/
if (getSavedApps.contains(pkgStats.getPackageName().toString())) {
//System.out.println("*** adding to map "+getSavedApps.get(j)+" & "+pkgStats.getPackageName());
if (existingStats == null) {
map.put(pkgStats.getPackageName(), pkgStats);
} else {
existingStats.add(pkgStats);
}
} else System.out.println("****no match found");
} catch (PackageManager.NameNotFoundException e) {
// This package may be gone.
}
}
mPackageStats.addAll(map.values());
// Sort list
mAppLabelComparator = new AppNameComparator(mAppLabelMap);
sortList();
}
示例11: UsageStatsAdapter
import android.util.ArrayMap; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
UsageStatsAdapter() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, -5);
final List<UsageStats> stats =
mUsageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_MONTHLY,
cal.getTimeInMillis(), System.currentTimeMillis());
for (UsageStats usg : stats) {
System.out.println("---------------------");
System.out.println("" + usg.getPackageName());
System.out.println("First time: " + usg.getFirstTimeStamp());
System.out.println("Last time :" + usg.getLastTimeStamp());
System.out.println("Total Time: " + usg.getTotalTimeInForeground());
System.out.println(usg.getLastTimeUsed());
System.out.println("---------------------");
}
if (stats == null) {
return;
}
ArrayMap<String, UsageStats> map = new ArrayMap<>();
final int statCount = stats.size();
for (int i = 0; i < statCount; i++) {
final UsageStats pkgStats = stats.get(i);
// load application labels for each application
try {
ApplicationInfo appInfo = mPm.getApplicationInfo(pkgStats.getPackageName(), 0);
String label = appInfo.loadLabel(mPm).toString();
mAppLabelMap.put(pkgStats.getPackageName(), label);
UsageStats existingStats =
map.get(pkgStats.getPackageName());
if (existingStats == null) {
map.put(pkgStats.getPackageName(), pkgStats);
} else {
existingStats.add(pkgStats);
}
} catch (PackageManager.NameNotFoundException e) {
// This package may be gone.
}
}
mPackageStats.addAll(map.values());
// Sort list
mAppLabelComparator = new AppNameComparator(mAppLabelMap);
sortList();
}
示例12: UsageStatsAdapter
import android.util.ArrayMap; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
UsageStatsAdapter() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, -5);
System.out.println("**Today****cal.getTime()*****" + cal.getTime() + "***getTimeMillis()***" + cal.getTimeInMillis());
System.out.println("**Today**System.currentTimeMillis()**** " + System.currentTimeMillis());
//final List<UsageStats>
stats = mUsageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_WEEKLY,
cal.getTimeInMillis(), System.currentTimeMillis());
System.out.println("---------------------" + stats);
for (UsageStats usg : stats) {
// System.out.println("***stats count "+stats.size());
// System.out.println("********************");
// System.out.println("" + usg.getPackageName());
// System.out.println("First time: " + usg.getFirstTimeStamp());
// System.out.println("Last time :" + usg.getLastTimeStamp());
// System.out.println("Total Time: " + usg.getTotalTimeInForeground());
// System.out.println(usg.getLastTimeUsed());
// System.out.println("********************");
//mPieChart.addPieSlice(new PieModel("", usg.getTotalTimeInForeground(), Color.parseColor(color)));
}
//mPieChart.startAnimation();
if (stats == null) {
return;
}
ArrayMap<String, UsageStats> map = new ArrayMap<>();
final int statCount = stats.size();
for (int i = 0; i < statCount; i++) {
final UsageStats pkgStats = stats.get(i);
// load application labels for each application
try {
ApplicationInfo appInfo = mPm.getApplicationInfo(pkgStats.getPackageName(), 0);
String label = appInfo.loadLabel(mPm).toString();
mAppLabelMap.put(pkgStats.getPackageName(), label);
UsageStats existingStats = map.get(pkgStats.getPackageName());
/*for(int j=0;j<getSavedApps.size();j++){
System.out.println("**********4");
System.out.println("*****getSavedApps.get(i)*****"+getSavedApps.get(i).toString());
System.out.println("*****pkgStats.getPackageName()*****"+pkgStats.getPackageName().toString());*/
if (getSavedApps.contains(pkgStats.getPackageName().toString())) {
//System.out.println("*** adding to map "+getSavedApps.get(j)+" & "+pkgStats.getPackageName());
if (existingStats == null) {
map.put(pkgStats.getPackageName(), pkgStats);
} else {
existingStats.add(pkgStats);
}
} else System.out.println("****no match found");
//}
/*if (existingStats == null) {
map.put(pkgStats.getPackageName(), pkgStats);
} else {
existingStats.add(pkgStats);
}*/
} catch (PackageManager.NameNotFoundException e) {
// This package may be gone.
}
}
mPackageStats.addAll(map.values());
// Sort list
//mAppLabelComparator = new AppNameComparator(mAppLabelMap);
//sortList();
}