のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

System.err Removed xxxxxxxx

    218     public static boolean updateHeaderToSpecificActivityFromMetaDataOrRemove(Context context,
    219             List<Header> target, Header header) {
    220 
    221         Intent intent = header.intent;
    222         if (intent != null) {
    223             // Find the activity that is in the system image
    224             PackageManager pm = context.getPackageManager();
    225             List<ResolveInfo> list = pm.queryIntentActivities(intent, PackageManager.GET_META_DATA);
    226             int listSize = list.size();
    227             for (int i = 0; i < listSize; i++) {
    228                 ResolveInfo resolveInfo = list.get(i);
    229                 if ((resolveInfo.activityInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM)
    230                         != 0) {
    231                     Drawable icon = null;
    232                     String title = null;
    233                     String summary = null;
    234 
    235                     // Get the activity's meta-data
    236                     try {
    237                         Resources res = pm.getResourcesForApplication(
    238                                 resolveInfo.activityInfo.packageName);
    239                         Bundle metaData = resolveInfo.activityInfo.metaData;
    240 
    241                         if (res != null && metaData != null) {
    242                             icon = res.getDrawable(metaData.getInt(META_DATA_PREFERENCE_ICON));
    243                             title = res.getString(metaData.getInt(META_DATA_PREFERENCE_TITLE));
    244                             summary = res.getString(metaData.getInt(META_DATA_PREFERENCE_SUMMARY));
    245                         }
    246                     } catch (NameNotFoundException e) {
    247                         // Ignore
    248                     } catch (NotFoundException e) {
    249                         // Ignore
    250                     }
    251 
    252                     // Set the preference title to the activity's label if no
    253                     // meta-data is found
    254                     if (TextUtils.isEmpty(title)) {
    255                         title = resolveInfo.loadLabel(pm).toString();
    256                     }
    257 
    258                     // Set icon, title and summary for the preference
    259                     // TODO:
    260                     //header.icon = icon;
    261                     header.title = title;
    262                     header.summary = summary;
    263                     // Replace the intent with this specific activity
    264                     header.intent = new Intent().setClassName(resolveInfo.activityInfo.packageName,
    265                             resolveInfo.activityInfo.name);
    266 
    267                     return true;
    268                 }
    269             }
    270         }
    271 
    272         // Did not find a matching activity, so remove the preference
    273         if (target.remove(header)) System.err.println("Removed " + header.id); <===ここかな?
    274 
    275         return false;
    276     }

>