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


Java Bundle.isEmpty方法代码示例

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


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

示例1: onHandleIntent

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
    Bundle extras = intent.getExtras();
    GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
    String messageType = gcm.getMessageType(intent);
    if (!extras.isEmpty()) {
    	if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {	    		
    		if (FlowzrSyncEngine.isRunning) {
     		Log.i(TAG,"sync already in progess");
    			return;
    		}
    		Log.i(TAG,"starting sync from GCM");
    		new FlowzrSyncTask(getApplicationContext()).execute();
        }
    }
}
 
开发者ID:tiberiusteng,项目名称:financisto1-holo,代码行数:17,代码来源:GCMIntentService.java

示例2: verifyAndInsert

import android.os.Bundle; //导入方法依赖的package包/类
protected long verifyAndInsert(ComponentName cn, Bundle extras) {
    mValues.put(Favorites.APPWIDGET_PROVIDER, cn.flattenToString());
    mValues.put(Favorites.RESTORED,
            LauncherAppWidgetInfo.FLAG_ID_NOT_VALID |
                    LauncherAppWidgetInfo.FLAG_PROVIDER_NOT_READY |
                    LauncherAppWidgetInfo.FLAG_DIRECT_CONFIG);
    mValues.put(Favorites._ID, mCallback.generateNewItemId());
    if (!extras.isEmpty()) {
        mValues.put(Favorites.INTENT, new Intent().putExtras(extras).toUri(0));
    }

    long insertedId = mCallback.insertAndCheck(mDb, mValues);
    if (insertedId < 0) {
        return -1;
    } else {
        return insertedId;
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:19,代码来源:AutoInstallsLayout.java

示例3: saveGame

import android.os.Bundle; //导入方法依赖的package包/类
private boolean saveGame() {
    Bundle bundle = new Bundle();
    onSaveGame(bundle);
    if (!bundle.isEmpty()) {
        Savegame savegame;
        if (savegameUuid == null) {
            savegame = new Savegame(game.getUuid(), bundle);
            savegameUuid = savegame.uuid;
        } else {
            savegame = savegameStorage.getFromUuid(savegameUuid);
            savegame.update(bundle);
        }
        savegameStorage.updateSavegame(savegame);
        Bundle extras = getIntent().getExtras();
        extras.putString(KEY_SAVEGAME_UUID, savegame.uuid);
        return true;
    }
    return false;
}
 
开发者ID:android-gamecollection,项目名称:gamecollection,代码行数:20,代码来源:GameActivity.java

示例4: switchActivity

import android.os.Bundle; //导入方法依赖的package包/类
private void switchActivity(Class<?> screen, Bundle bundle, AnimationType animation, boolean isActivityRoot) {
    Intent intent = activityFactory.getActivityByName(screen);
    if (isActivityRoot) {
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    }
    if (bundle != null && !bundle.isEmpty()) {
        intent.putExtras(bundle);
    }
    activity.startActivity(intent);
    switch (animation) {
        case FADE_TYPE:
            activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
            break;
        case RIGHT_TO_LEFT_TYPE:
            activity.overridePendingTransition(R.anim.right_to_left_in, R.anim.right_to_left_out);
            break;
        case LEFT_TO_RIGHT_TYPE:
            activity.overridePendingTransition(R.anim.left_to_right_in, R.anim.left_to_right_out);
            break;
    }
}
 
开发者ID:steelkiwi,项目名称:NavigationTools,代码行数:22,代码来源:NavigationManager.java

示例5: encodeUrl

import android.os.Bundle; //导入方法依赖的package包/类
/**
 * 将key-value形式的参数串,转换成key1=value1&key2=value2格式的query
 *
 * @param params key-value参数
 * @return key1=value1&key2=value2格式的query
 */
public static String encodeUrl(Bundle params) {
    if (params == null || params.isEmpty()) {
        return null;
    }
    boolean first = true;
    StringBuilder sb = new StringBuilder();
    for (String key : params.keySet()) {
        String paramValue = params.getString(key);
        if (paramValue == null) {
            continue;
        }
        if (first) {
            first = false;
        } else {
            sb.append("&");
        }
        sb.append(URLEncoder.encode(key)).append("=").append(URLEncoder.encode(paramValue));
    }
    return sb.toString();
}
 
开发者ID:dueros,项目名称:dcs-sdk-java,代码行数:27,代码来源:CommonUtil.java

示例6: saveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
void saveInstanceState(@NonNull Object target, @NonNull Bundle state) {
    String uuid = mObjectUuidMap.get(target);
    if (uuid == null) {
        uuid = UUID.randomUUID().toString();
        mObjectUuidMap.put(target, uuid);
    }
    state.putString(getKeyForUuid(target), uuid);
    Bundle bundle = new Bundle();
    mSavedStateHandler.saveInstanceState(target, bundle);
    if (bundle.isEmpty()) {
        // Don't bother saving empty bundles
        return;
    }
    WrapperUtils.wrapOptimizedObjects(bundle);
    mRecentUuids.add(uuid);
    mUuidBundleMap.put(uuid, bundle);
    writeToDisk(uuid, bundle);
    clearStaleData();
}
 
开发者ID:livefront,项目名称:bridge,代码行数:20,代码来源:BridgeDelegate.java

示例7: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scheme);

    TextView text = (TextView) findViewById(R.id.text_test);
    Bundle bundle = getIntent().getExtras();
    if (bundle != null && !bundle.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        sb.append("id:")
                .append(bundle.getString("id"))
                .append("\n")
                .append("status:")
                .append(bundle.getString("status"));
        text.setText(sb.toString());
    }

}
 
开发者ID:chenenyu,项目名称:Router,代码行数:19,代码来源:ImplicitActivity.java

示例8: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test);

    Router.injectParams(this);

    Bundle mExtras = getIntent().getExtras();
    id = mExtras.getString("id", id);

    TextView text = (TextView) findViewById(R.id.text_test);
    Bundle bundle = getIntent().getExtras();
    if (bundle != null && !bundle.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        sb.append("id:")
                .append(id)
                .append("\n")
                .append("status:")
                .append(sts);
        text.setText(sb.toString());
    }
}
 
开发者ID:chenenyu,项目名称:Router,代码行数:23,代码来源:TestActivity.java

示例9: parseDecodeHints

import android.os.Bundle; //导入方法依赖的package包/类
static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
  Bundle extras = intent.getExtras();
  if (extras == null || extras.isEmpty()) {
    return null;
  }
  Map<DecodeHintType,Object> hints = new EnumMap<DecodeHintType,Object>(DecodeHintType.class);

  for (DecodeHintType hintType: DecodeHintType.values()) {

    if (hintType == DecodeHintType.CHARACTER_SET ||
        hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
        hintType == DecodeHintType.POSSIBLE_FORMATS) {
      continue; // This hint is specified in another way
    }

    String hintName = hintType.name();
    if (extras.containsKey(hintName)) {
      if (hintType.getValueType().equals(Void.class)) {
        // Void hints are just flags: use the constant specified by the DecodeHintType
        hints.put(hintType, Boolean.TRUE);
      } else {
        Object hintData = extras.get(hintName);
        if (hintType.getValueType().isInstance(hintData)) {
          hints.put(hintType, hintData);
        } else {
          Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
        }
      }
    }
  }

  Log.i(TAG, "Hints from the Intent: " + hints);
  return hints;
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:35,代码来源:DecodeHintManager.java

示例10: parseDecodeHints

import android.os.Bundle; //导入方法依赖的package包/类
static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
  Bundle extras = intent.getExtras();
  if (extras == null || extras.isEmpty()) {
    return null;
  }
  Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);

  for (DecodeHintType hintType: DecodeHintType.values()) {

    if (hintType == DecodeHintType.CHARACTER_SET ||
        hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
        hintType == DecodeHintType.POSSIBLE_FORMATS) {
      continue; // This hint is specified in another way
    }

    String hintName = hintType.name();
    if (extras.containsKey(hintName)) {
      if (hintType.getValueType().equals(Void.class)) {
        // Void hints are just flags: use the constant specified by the DecodeHintType
        hints.put(hintType, Boolean.TRUE);
      } else {
        Object hintData = extras.get(hintName);
        if (hintType.getValueType().isInstance(hintData)) {
          hints.put(hintType, hintData);
        } else {
          Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
        }
      }
    }
  }

  Log.i(TAG, "Hints from the Intent: " + hints);
  return hints;
}
 
开发者ID:kkyflying,项目名称:CodeScaner,代码行数:35,代码来源:DecodeHintManager.java

示例11: setParams

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void setParams(Bundle params) {
    if (params == null) {
        return;
    }
    if (params.isEmpty()) {
        resetAccountButton.setVisibility(VISIBLE);
        resetAccountText.setVisibility(VISIBLE);
        AndroidUtilities.hideKeyboard(codeField);
        return;
    }
    resetAccountButton.setVisibility(GONE);
    resetAccountText.setVisibility(GONE);
    codeField.setText("");
    currentParams = params;
    current_salt = Utilities.hexToBytes(currentParams.getString("current_salt"));
    hint = currentParams.getString("hint");
    has_recovery = currentParams.getInt("has_recovery") == 1;
    email_unconfirmed_pattern = currentParams.getString("email_unconfirmed_pattern");
    requestPhone = params.getString("phoneFormated");
    phoneHash = params.getString("phoneHash");
    phoneCode = params.getString("code");

    AndroidUtilities.showKeyboard(codeField);
    codeField.requestFocus();


    if (hint != null && hint.length() > 0) {
        codeField.setHint(hint);
    } else {
        codeField.setHint(LocaleController.getString("LoginPassword", R.string.LoginPassword));
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:34,代码来源:LoginActivity.java

示例12: setParams

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void setParams(Bundle params) {
    if (params == null) {
        return;
    }
    if (params.isEmpty()) {
        resetAccountButton.setVisibility(VISIBLE);
        resetAccountText.setVisibility(VISIBLE);
        AndroidUtilities.hideKeyboard(codeField);
        return;
    }
    resetAccountButton.setVisibility(GONE);
    resetAccountText.setVisibility(GONE);
    codeField.setText("");
    currentParams = params;
    current_salt = Utilities.hexToBytes(currentParams.getString("current_salt"));
    hint = currentParams.getString("hint");
    has_recovery = currentParams.getInt("has_recovery") == 1;
    email_unconfirmed_pattern = currentParams.getString("email_unconfirmed_pattern");
    requestPhone = params.getString("phoneFormated");
    phoneHash = params.getString("phoneHash");
    phoneCode = params.getString("code");

    if (hint != null && hint.length() > 0) {
        codeField.setHint(hint);
    } else {
        codeField.setHint(LocaleController.getString("LoginPassword", R.string.LoginPassword));
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:30,代码来源:LoginActivity.java

示例13: parseDecodeHints

import android.os.Bundle; //导入方法依赖的package包/类
public static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
  Bundle extras = intent.getExtras();
  if (extras == null || extras.isEmpty()) {
    return null;
  }
  Map<DecodeHintType,Object> hints = new EnumMap(DecodeHintType.class);

  for (DecodeHintType hintType: DecodeHintType.values()) {

    if (hintType == DecodeHintType.CHARACTER_SET ||
        hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
        hintType == DecodeHintType.POSSIBLE_FORMATS) {
      continue; // This hint is specified in another way
    }

    String hintName = hintType.name();
    if (extras.containsKey(hintName)) {
      if (hintType.getValueType().equals(Void.class)) {
        // Void hints are just flags: use the constant specified by the DecodeHintType
        hints.put(hintType, Boolean.TRUE);
      } else {
        Object hintData = extras.get(hintName);
        if (hintType.getValueType().isInstance(hintData)) {
          hints.put(hintType, hintData);
        } else {
          Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
        }
      }
    }
  }

  Log.i(TAG, "Hints from the Intent: " + hints);
  return hints;
}
 
开发者ID:yun2win,项目名称:tvConnect_android,代码行数:35,代码来源:DecodeHintManager.java

示例14: upload

import android.os.Bundle; //导入方法依赖的package包/类
public static Statistic upload(Context context, String str, Bundle bundle) throws MalformedURLException, IOException, NetworkUnavailableException, HttpStatusException {
    int size;
    int i;
    byte[] byteArray;
    if (context != null) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
        if (connectivityManager != null) {
            NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
            if (activeNetworkInfo == null || !activeNetworkInfo.isAvailable()) {
                throw new NetworkUnavailableException(NetworkUnavailableException.ERROR_INFO);
            }
        }
    }
    Bundle bundle2 = new Bundle(bundle);
    String str2 = "";
    str2 = bundle2.getString("appid_for_getting_config");
    bundle2.remove("appid_for_getting_config");
    HttpClient httpClient = HttpUtils.getHttpClient(context, str2, str);
    HttpUriRequest httpPost = new HttpPost(str);
    Bundle bundle3 = new Bundle();
    for (String str22 : bundle2.keySet()) {
        Object obj = bundle2.get(str22);
        if (obj instanceof byte[]) {
            bundle3.putByteArray(str22, (byte[]) obj);
        }
    }
    httpPost.setHeader(HttpRequest.HEADER_CONTENT_TYPE, "multipart/form-data; boundary=3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f");
    httpPost.setHeader("Connection", "Keep-Alive");
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    byteArrayOutputStream.write(getBytesUTF8("--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f\r\n"));
    byteArrayOutputStream.write(getBytesUTF8(encodePostBody(bundle2, "3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f")));
    if (!bundle3.isEmpty()) {
        size = bundle3.size();
        byteArrayOutputStream.write(getBytesUTF8("\r\n--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f\r\n"));
        i = -1;
        for (String str222 : bundle3.keySet()) {
            i++;
            byteArrayOutputStream.write(getBytesUTF8("Content-Disposition: form-data; name=\"" + str222 + "\"; filename=\"" + "value.file" + "\"" + "\r\n"));
            byteArrayOutputStream.write(getBytesUTF8("Content-Type: application/octet-stream\r\n\r\n"));
            byteArray = bundle3.getByteArray(str222);
            if (byteArray != null) {
                byteArrayOutputStream.write(byteArray);
            }
            if (i < size - 1) {
                byteArrayOutputStream.write(getBytesUTF8("\r\n--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f\r\n"));
            }
        }
    }
    byteArrayOutputStream.write(getBytesUTF8("\r\n--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f--\r\n"));
    byteArray = byteArrayOutputStream.toByteArray();
    i = byteArray.length + 0;
    byteArrayOutputStream.close();
    httpPost.setEntity(new ByteArrayEntity(byteArray));
    HttpResponse execute = httpClient.execute(httpPost);
    size = execute.getStatusLine().getStatusCode();
    if (size == 200) {
        return new Statistic(a(execute), i);
    }
    throw new HttpStatusException(HttpStatusException.ERROR_INFO + size);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:61,代码来源:Util.java

示例15: a

import android.os.Bundle; //导入方法依赖的package包/类
private String a(Bundle bundle) {
    if (bundle == null || bundle.isEmpty()) {
        return "";
    }
    StringBuilder stringBuilder = new StringBuilder();
    for (String str : bundle.keySet()) {
        stringBuilder.append(str).append(SearchCriteria.EQ).append(bundle.get(str)).append("&");
    }
    String str2 = stringBuilder.toString();
    if (str2.endsWith("&")) {
        str2 = str2.substring(0, str2.length() - 1);
    }
    f.b("AppbarAgent", "-->encodeParams, result: " + str2);
    return str2;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:16,代码来源:AppbarAgent.java


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