当前位置: 首页>>代码示例>>Java>>正文


Java ArrayMap.get方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:25,代码来源:AppNotificationSettings.java

示例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);
        }
    }
}
 
开发者ID:TaRGroup,项目名称:IFWManager,代码行数:23,代码来源:IntentResolver.java

示例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();
	}
  }
}
 }
 
开发者ID:TIIEHenry,项目名称:TIIEHenry-Android-SDK,代码行数:28,代码来源:ZipUtil.java

示例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);
        }
    }
}
 
开发者ID:TaRGroup,项目名称:IFWManager,代码行数:28,代码来源:IntentResolver.java

示例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;
}
 
开发者ID:mkjensen,项目名称:danish-media-license,代码行数:12,代码来源:LocalCallFactory.java

示例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);
        }
    }
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:28,代码来源:IntentResolver.java

示例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();
        }
 
开发者ID:spate141,项目名称:App-Monitor,代码行数:68,代码来源:Today.java

示例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();
        }
 
开发者ID:spate141,项目名称:App-Monitor,代码行数:78,代码来源:Yesterday.java

示例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();
        }
 
开发者ID:spate141,项目名称:App-Monitor,代码行数:78,代码来源:LastMonth.java

示例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();
        }
 
开发者ID:spate141,项目名称:App-Monitor,代码行数:69,代码来源:AppService.java

示例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();
}
 
开发者ID:spate141,项目名称:App-Monitor,代码行数:53,代码来源:Sorting.java

示例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();
        }
 
开发者ID:spate141,项目名称:App-Monitor,代码行数:78,代码来源:LastWeek.java


注:本文中的android.util.ArrayMap.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。