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


Java Intent.getBooleanArrayExtra方法代码示例

本文整理汇总了Java中android.content.Intent.getBooleanArrayExtra方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.getBooleanArrayExtra方法的具体用法?Java Intent.getBooleanArrayExtra怎么用?Java Intent.getBooleanArrayExtra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.Intent的用法示例。


在下文中一共展示了Intent.getBooleanArrayExtra方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == CommonConstant.REQUEST_CODE && resultCode == RESULT_OK) {
        final boolean[] delLove = data.getBooleanArrayExtra(CommonConstant.RESULT_KEY);
        // 延迟 500MS 做删除操作,不然退回来看不到动画效果
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                for (int i = delLove.length - 1; i >= 0; i--) {
                    if (delLove[i]) {
                        mAdapter.removeItem(i);
                    }
                }
            }
        }, 500);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:LovePhotoFragment.java

示例2: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(final Context context, Intent intent) {
  if (DELETE_NOTIFICATION_ACTION.equals(intent.getAction())) {
    MessageNotifier.clearReminder(context);

    final long[]    ids = intent.getLongArrayExtra(EXTRA_IDS);
    final boolean[] mms = intent.getBooleanArrayExtra(EXTRA_MMS);

    if (ids == null  || mms == null || ids.length != mms.length) return;

    new AsyncTask<Void, Void, Void>() {
      @Override
      protected Void doInBackground(Void... params) {
        for (int i=0;i<ids.length;i++) {
          if (!mms[i]) DatabaseFactory.getSmsDatabase(context).markAsNotified(ids[i]);
          else         DatabaseFactory.getMmsDatabase(context).markAsNotified(ids[i]);
        }

        return null;
      }
    }.execute();
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:24,代码来源:DeleteNotificationReceiver.java

示例3: getValue

import android.content.Intent; //导入方法依赖的package包/类
/**
 * Get a value from an intent by a giving class and key.
 * @param intent
 *  the source intent
 * @param key
 *  the key of the value
 * @param clz
 *  the class of the value
 * @return
 *  the value from the source intent
 */
public static Object getValue(Intent intent, String key, Class<?> clz) {
    Object value = null;
    // Cause it is not an easy job to handle inheritance in apt, it is a lot easier to put the code in the Android environment.
    if(Bundle.class.isAssignableFrom(clz)) {
        // bundle implements parcelable, so it should place before parcelable.
        value = intent.getBundleExtra(key);
    } else if(Parcelable.class.isAssignableFrom(clz)) {
        value = intent.getParcelableExtra(key);
    } else if(Parcelable[].class.isAssignableFrom(clz)) {
        value = intent.getParcelableArrayExtra(key);
    } else if(boolean[].class.isAssignableFrom(clz)) {
        value = intent.getBooleanArrayExtra(key);
    } else if(byte[].class.isAssignableFrom(clz)) {
        value = intent.getByteArrayExtra(key);
    } else if(short[].class.isAssignableFrom(clz)) {
        value = intent.getShortArrayExtra(key);
    } else if(char[].class.isAssignableFrom(clz)) {
        value = intent.getCharArrayExtra(key);
    } else if(int[].class.isAssignableFrom(clz)) {
        value = intent.getIntArrayExtra(key);
    } else if(long[].class.isAssignableFrom(clz)) {
        value = intent.getLongArrayExtra(key);
    } else if(float[].class.isAssignableFrom(clz)) {
        value = intent.getFloatArrayExtra(key);
    } else if(double[].class.isAssignableFrom(clz)) {
        value = intent.getDoubleArrayExtra(key);
    } else if(String[].class.isAssignableFrom(clz)) {
        value = intent.getStringArrayExtra(key);
    } else if(CharSequence[].class.isAssignableFrom(clz)) {
        value = intent.getCharSequenceArrayExtra(key);
    } else if(Serializable.class.isAssignableFrom(clz)) {
        // some of the above are assignable for serializable, so serializable should be in the last place.
        value = intent.getSerializableExtra(key);
    } else {
        throw new RuntimeException(clz + " is not compatible with intent (key=" + key + ")");
    }

    return value;
}
 
开发者ID:foreveruseful,项目名称:smartkey,代码行数:51,代码来源:IntentValueGetter.java


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