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


Java Bundle.putLong方法代码示例

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


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

示例1: put

import android.os.Bundle; //导入方法依赖的package包/类
public static Bundle put(Bundle to, Intent from, String key) {
    if (!(to == null || from == null || TextUtils.empty(key) || !from.hasExtra(key))) {
        Object value = from.getExtras().get(key);
        if (value instanceof Boolean) {
            to.putBoolean(key, ((Boolean) value).booleanValue());
        } else if (value instanceof Byte) {
            to.putByte(key, ((Byte) value).byteValue());
        } else if (value instanceof Character) {
            to.putChar(key, ((Character) value).charValue());
        } else if (value instanceof Short) {
            to.putShort(key, ((Short) value).shortValue());
        } else if (value instanceof Integer) {
            to.putInt(key, ((Integer) value).intValue());
        } else if (value instanceof Long) {
            to.putLong(key, ((Long) value).longValue());
        } else if (value instanceof Float) {
            to.putFloat(key, ((Float) value).floatValue());
        } else if (value instanceof Double) {
            to.putDouble(key, ((Double) value).doubleValue());
        } else if (value instanceof String) {
            to.putString(key, (String) value);
        }
    }
    return to;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:26,代码来源:KVUtils.java

示例2: startWithMissingProperty

import android.os.Bundle; //导入方法依赖的package包/类
@Test
public void startWithMissingProperty()
{
    Intent intent = new Intent();
    final Bundle bundle = new Bundle();
    bundle.putLong("id", 0);
    intent.putExtras(bundle);

    ActivityController controller = Robolectric.buildActivity(PropertyNotesActivity.class, intent).create();
    Activity activity = (Activity)controller.get();

    assertTrue(activity.isFinishing());

    String latestToast = ShadowToast.getTextOfLatestToast();
    assertNotNull(latestToast);
}
 
开发者ID:brarcher,项目名称:rental-calc,代码行数:17,代码来源:PropertyNotesActivityTest.java

示例3: createFragmentArguments

import android.os.Bundle; //导入方法依赖的package包/类
private Bundle createFragmentArguments(ReadableMap options) {
  final Bundle args = new Bundle();
  if (options.hasKey(ARG_DATE) && !options.isNull(ARG_DATE)) {
    args.putLong(ARG_DATE, (long) options.getDouble(ARG_DATE));
  }
  if (options.hasKey(ARG_MINDATE) && !options.isNull(ARG_MINDATE)) {
    args.putLong(ARG_MINDATE, (long) options.getDouble(ARG_MINDATE));
  }
  if (options.hasKey(ARG_MAXDATE) && !options.isNull(ARG_MAXDATE)) {
    args.putLong(ARG_MAXDATE, (long) options.getDouble(ARG_MAXDATE));
  }
  if (options.hasKey(ARG_MODE) && !options.isNull(ARG_MODE)) {
    args.putString(ARG_MODE, options.getString(ARG_MODE));
  }
  return args;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:17,代码来源:DatePickerDialogModule.java

示例4: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putBoolean(GAME_PAUSE_KEY, mGamePaused);
    outState.putBoolean(GAME_OVER_KEY, mGameOver);
    outState.putLong(TIME_REMAINING_KEY, mTimeRemaining);
    outState.putInt(COIN_COUNT_KEY, mCoinCount);
    super.onSaveInstanceState(outState);
}
 
开发者ID:googlecodelabs,项目名称:admob-rewarded-video,代码行数:9,代码来源:MainActivity.java

示例5: onOptionsItemSelected

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
  switch (item.getItemId()) {
  case R.id.default_options:
    AlarmOptions options = new AlarmOptions();
    Bundle b = new Bundle();
    b.putLong(AlarmNotificationService.ALARM_ID, DbUtil.Settings.DEFAULTS_ID);
    options.setArguments(b);
    options.show(getFragmentManager(), "default_alarm_options");
    return true;

  case R.id.display_notification:
    boolean new_val = !item.isChecked();
    item.setChecked(new_val);
    PreferenceManager.getDefaultSharedPreferences(this)
      .edit()
      .putBoolean(AlarmNotificationService.DISPLAY_NOTIFICATION, new_val)
      .commit();
    AlarmNotificationService.refreshNotificationBar(this);
    return true;

  case R.id.delete_all:
    new DeleteAllConfirmation()
      .show(getFragmentManager(), "confirm_delete_all");

    return true;
  default:
    return super.onOptionsItemSelected(item);
  }
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:31,代码来源:AlarmClockActivity.java

示例6: logAuthorizationMethodComplete

import android.os.Bundle; //导入方法依赖的package包/类
private void logAuthorizationMethodComplete(String method, String result, String errorMessage, String errorCode,
        Map<String, String> loggingExtras) {
    Bundle bundle = null;
    if (pendingRequest == null) {
        // We don't expect this to happen, but if it does, log an event for diagnostic purposes.
        bundle = newAuthorizationLoggingBundle("");
        bundle.putString(EVENT_PARAM_LOGIN_RESULT, Result.Code.ERROR.getLoggingValue());
        bundle.putString(EVENT_PARAM_ERROR_MESSAGE,
                "Unexpected call to logAuthorizationMethodComplete with null pendingRequest.");
    } else {
        bundle = newAuthorizationLoggingBundle(pendingRequest.getAuthId());
        if (result != null) {
            bundle.putString(EVENT_PARAM_LOGIN_RESULT, result);
        }
        if (errorMessage != null) {
            bundle.putString(EVENT_PARAM_ERROR_MESSAGE, errorMessage);
        }
        if (errorCode != null) {
            bundle.putString(EVENT_PARAM_ERROR_CODE, errorCode);
        }
        if (loggingExtras != null && !loggingExtras.isEmpty()) {
            JSONObject jsonObject = new JSONObject(loggingExtras);
            bundle.putString(EVENT_PARAM_EXTRAS, jsonObject.toString());
        }
    }
    bundle.putString(EVENT_PARAM_METHOD, method);
    bundle.putLong(EVENT_PARAM_TIMESTAMP, System.currentTimeMillis());

    getAppEventsLogger().logSdkEvent(EVENT_NAME_LOGIN_METHOD_COMPLETE, null, bundle);
}
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:31,代码来源:AuthorizationClient.java

示例7: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if(selected_color != null) {
        outState.putInt("selected_color", selected_color);
    }
    outState.putLong("label_id", labelId);
}
 
开发者ID:danlls,项目名称:Todule-android,代码行数:9,代码来源:ToduleLabelAddFragment.java

示例8: create

import android.os.Bundle; //导入方法依赖的package包/类
public static TimelineFragment create(Account account, long timelineId) {
    Bundle args = new Bundle();
    args.putLong("timeline_id", timelineId);
    args.putParcelable("account", account);

    TimelineFragment fragment = new TimelineFragment();
    fragment.setArguments(args);

    return fragment;
}
 
开发者ID:mecid,项目名称:robird-reborn,代码行数:11,代码来源:TimelineFragment.java

示例9: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putParcelable("departureStation", departureStation);
    outState.putString("selectedLine", selectedLine.getCode());
    outState.putLong("departureDate", departureDate.getTimeInMillis());
    outState.putString("trip", tripId);
}
 
开发者ID:Baleine82,项目名称:TrainPonctuality,代码行数:10,代码来源:InputDepartureActivity.java

示例10: newInstance

import android.os.Bundle; //导入方法依赖的package包/类
public static ArticleDetailFragment newInstance(long itemId) {
    Bundle arguments = new Bundle();
    arguments.putLong(ARG_ITEM_ID, itemId);
    ArticleDetailFragment fragment = new ArticleDetailFragment();
    fragment.setArguments(arguments);
    return fragment;
}
 
开发者ID:rashikaranpuria,项目名称:xyz-reader-2,代码行数:8,代码来源:ArticleDetailFragment.java

示例11: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    if (_photoUrl != null) {
        outState.putString(KEY_PHOTO_URL, _photoUrl);
    }
    if (_photoId != null) {
        outState.putLong(KEY_PHOTO_ID, _photoId);
    }
}
 
开发者ID:StephanBezoen,项目名称:tumblrlikes,代码行数:12,代码来源:PhotoFragment.java

示例12: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (tvDateToSearch.getText().length() > 0) {
        outState.putLong(DATE_TO_IN_MILLIS_KEY, mDateToCalendar.getTimeInMillis());
    }
    if (tvDateFromSearch.getText().length() > 0) {
        outState.putLong(DATE_FROM_IN_MILLIS_KEY, mDateFromCalendar.getTimeInMillis());
    }
}
 
开发者ID:mkeresztes,项目名称:AndiCar,代码行数:11,代码来源:SearchDialogFragment.java

示例13: updateService

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void updateService(String updateservices) {
    Intent intent = new Intent(updateservices);
    if (updateservices.equals(PLAYSTATE_CHANGED) && intent.getAction().equals(PLAYSTATE_CHANGED)) {
        sendBroadcast(intent);
    } else if (updateservices.equals(META_CHANGED) && intent.getAction().equals(META_CHANGED)) {
        Bundle bundle = new Bundle();
        bundle.putString(SONG_TITLE, getsongTitle());
        bundle.putString(SONG_ALBUM, getsongAlbumName());
        bundle.putLong(SONG_ALBUM_ID, getsongAlbumID());
        bundle.putString(SONG_ARTIST, getsongArtistName());
        bundle.putLong(SONG_ID, getsongId());
        bundle.putString(SONG_PATH, getsongData());
        bundle.putInt(SONG_TRACK_NUMBER, getsongNumber());
        bundle.putInt(POSITION_CHANGED, returnpos());
        intent.putExtras(bundle);
        Log.d(TAG, "broadcast song metadata");
        sendBroadcast(intent);
    } else if ((updateservices.equals(QUEUE_CHANGED) || updateservices.equals(ORDER_CHANGED) || updateservices.equals(ITEM_ADDED)) && (intent.getAction().equals(QUEUE_CHANGED) || intent.getAction().equals(ORDER_CHANGED) || intent.getAction().equals(ITEM_ADDED))) {
        sendBroadcast(intent);
        saveState(true);
    }
    if (onPlayNotify) {
        if (!Extras.getInstance().hideNotify()) {
            NotificationHandler.buildNotification(MusicXService.this, updateservices);
        }
    }
    musicxWidget.notifyChange(this, updateservices);
    musicXwidget4x4.notifyChange(this, updateservices);
    musicXWidget5x5.notifyChange(this, updateservices);
    if (!Extras.getInstance().hideLockscreen()) {
        MediaSession.lockscreenMedia(getMediaSession(), MusicXService.this, updateservices);
    }
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:35,代码来源:MusicXService.java

示例14: onClick

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    Bundle bundle = new Bundle();
    Genre genre = (Genre) mData.get(getAdapterPosition());
    bundle.putString(Constants.HEADER_TITLE, genre._genreName);
    bundle.putInt(Constants.HEADER_SUB_TITLE, genre._noOfAlbumsInGenre);
    bundle.putString(Constants.FROM_WHERE, "GENRES");
    bundle.putLong(Constants.SELECTION_VALUE, genre._genreId);
    bundle.putString(Constants.COVER_PATH, genre._genreAlbumArt);

    TracksSubGridViewFragment tracksSubGridViewFragment = new TracksSubGridViewFragment();
    tracksSubGridViewFragment.setArguments(bundle);
    mSearchActivity.addFragment(tracksSubGridViewFragment);
}
 
开发者ID:reyanshmishra,项目名称:Rey-MusicPlayer,代码行数:15,代码来源:SearchAdapter.java

示例15: showPublicChatRoom

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void showPublicChatRoom(DialogModel dialogModel) {
    String tag = CHAT_ROOM_FR_TAG + dialogModel.getDialogId();
    FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction();
    Fragment fragment = getActivity().getSupportFragmentManager().findFragmentByTag(tag);
    getActivity().getSupportFragmentManager().popBackStackImmediate();
    if (fragment != null) {
        transaction.replace(R.id.main_screen_container, fragment, tag)
                .commit();
        return;
    }

    fragment = new ChatRoomFragment();
    Bundle args = new Bundle();
    args.putString(ChatRoomFragment.DIALOG_ID_BUNDLE_KEY, dialogModel.getDialogId());
    args.putLong(ChatRoomFragment.DIALOG_ADMIN_BUNDLE_KEY, dialogModel.getAdminId());
    args.putString(ChatRoomFragment.DIALOG_NAME_BUNDLE_KEY, dialogModel.getName());
    args.putInt(ChatRoomFragment.DIALOG_TYPE_BUNDLE_KEY, dialogModel.getType());
    args.putString(ChatRoomFragment.DIALOG_ROOM_JID_BUNDLE_KEY, dialogModel.getXmppRoomJid());
    ArrayList<Integer> list = new ArrayList<>(dialogModel.getOccupantsIds());
    args.putIntegerArrayList(ChatRoomFragment.OCCUPANTS_IDS_BUNDLE_KEY, list);

    fragment.setArguments(args);
    transaction.replace(R.id.main_screen_container, fragment, tag)
            .addToBackStack(null)
            .commit();
}
 
开发者ID:ukevgen,项目名称:BizareChat,代码行数:28,代码来源:NewChatFragment.java


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