android.os.Bundle.getLong()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(235)

本文整理了Java中android.os.Bundle.getLong()方法的一些代码示例,展示了Bundle.getLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle.getLong()方法的具体详情如下:
包路径:android.os.Bundle
类名称:Bundle
方法名:getLong

Bundle.getLong介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public void onCreate(Bundle icicle) {
 if (icicle != null){
  value = icicle.getLong("param");
 }
}

代码示例来源:origin: facebook/facebook-android-sdk

/**
 * Gets an long value out of the object.
 * @param key The key for the value.
 * @param defaultValue The value to return if no value is found for the specified key.
 * @return The long value.
 */
public long getLong(final String key, final long defaultValue) {
  return this.bundle.getLong(key, defaultValue);
}

代码示例来源:origin: facebook/facebook-android-sdk

static Date getDate(Bundle bundle, String key) {
  if (bundle == null) {
    return null;
  }
  long n = bundle.getLong(key, INVALID_BUNDLE_MILLISECONDS);
  if (n == INVALID_BUNDLE_MILLISECONDS) {
    return null;
  }
  return new Date(n);
}

代码示例来源:origin: stackoverflow.com

Bundle receiveBundle = this.getIntent().getExtras();
 final long receiveValue = receiveBundle.getLong("value");
 receiveValueEdit.setText(String.valueOf(receiveValue));
 callReceiverButton.setOnClickListener(new OnClickListener() {
   public void onClick(View v) {
     Intent i = new Intent(Activity2.this, Receiver.class);
     i.putExtra("new value", receiveValue - 10);
   }
 });

代码示例来源:origin: aa112901/remusic

@Override
public ArtistInfo createFromParcel(Parcel source) {
  Bundle bundle = source.readBundle();
  ArtistInfo info = new ArtistInfo();
  info.artist_name = bundle.getString(KEY_ARTIST_NAME);
  info.number_of_tracks = bundle.getInt(KEY_NUMBER_OF_TRACKS);
  info.artist_id = bundle.getLong(KEY_ARTIST_ID);
  info.artist_sort = bundle.getString(KEY_ARTIST_SORT);
  return info;
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
 super.onRestoreInstanceState(savedInstanceState);
 dumpBundleToLog("restore", savedInstanceState);
 creationTime=savedInstanceState.getLong(STATE_CREATION_TIME, -1L);
 Log.d(getClass().getSimpleName(), "onRestoreInstanceState() called");
}

代码示例来源:origin: naman14/Timber

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  if (getArguments() != null) {
    artistID = getArguments().getLong(Constants.ARTIST_ID);
  }
}

代码示例来源:origin: naman14/Timber

public void run() {
    long albumID = getIntent().getExtras().getLong(Constants.ALBUM_ID);
    Fragment fragment = AlbumDetailFragment.newInstance(albumID, false, null);
    FragmentManager fragmentManager = getSupportFragmentManager();
    fragmentManager.beginTransaction()
        .replace(R.id.fragment_container, fragment).commit();
  }
};

代码示例来源:origin: naman14/Timber

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  if (getArguments() != null) {
    artistID = getArguments().getLong(Constants.ARTIST_ID);
  }
}

代码示例来源:origin: naman14/Timber

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  if (getArguments() != null) {
    artistID = getArguments().getLong(Constants.ARTIST_ID);
  }
}

代码示例来源:origin: naman14/Timber

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  if (getArguments() != null) {
    artistID = getArguments().getLong(Constants.ARTIST_ID);
  }
}

代码示例来源:origin: naman14/Timber

public void run() {
    long artistID = getIntent().getExtras().getLong(Constants.ARTIST_ID);
    Fragment fragment = ArtistDetailFragment.newInstance(artistID, false, null);
    FragmentManager fragmentManager = getSupportFragmentManager();
    fragmentManager.beginTransaction()
        .replace(R.id.fragment_container, fragment).commit();
  }
};

代码示例来源:origin: naman14/Timber

private void setAlbumart() {
  playlistname.setText(getIntent().getExtras().getString(Constants.PLAYLIST_NAME));
  foreground.setBackgroundColor(getIntent().getExtras().getInt(Constants.PLAYLIST_FOREGROUND_COLOR));
  loadBitmap(TimberUtils.getAlbumArtUri(getIntent().getExtras().getLong(Constants.ALBUM_ID)).toString());
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
 super.onRestoreInstanceState(savedInstanceState);
 dumpBundleToLog("restore", savedInstanceState);
 creationTime=savedInstanceState.getLong(STATE_CREATION_TIME, -1L);
}

代码示例来源:origin: naman14/Timber

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  if (getArguments() != null) {
    albumID = getArguments().getLong(Constants.ALBUM_ID);
  }
  context = getActivity();
  mContext = (AppCompatActivity) context;
  mPreferences = PreferencesUtility.getInstance(context);
}

代码示例来源:origin: naman14/Timber

@Override
protected String doInBackground(String... params) {
  playlistID = getIntent().getExtras().getLong(Constants.PLAYLIST_ID);
  List<Song> playlistsongs = PlaylistSongLoader.getSongsInPlaylist(mContext, playlistID);
  mAdapter = new SongsListAdapter(mContext, playlistsongs, true, animate);
  mAdapter.setPlaylistId(playlistID);
  return "Executed";
}

代码示例来源:origin: robolectric/robolectric

@Test
public void getLong() {
 bundle.putLong("foo", 5);
 assertThat(bundle.getLong("foo")).isEqualTo(5);
 assertThat(bundle.getLong("bar")).isEqualTo(0);
 assertThat(bundle.getLong("bar", 7)).isEqualTo(7);
}

代码示例来源:origin: aa112901/remusic

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  if (getArguments() != null) {
    playlsitId = getArguments().getLong("playlistid");
    albumPath = getArguments().getString("albumart");
    playlistname = getArguments().getString("playlistname");
  }
  context = getActivity();
  playlistsManager = PlaylistsManager.getInstance(context);
}

代码示例来源:origin: aa112901/remusic

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  if (getArguments() != null) {
    artistID = getArguments().getLong("artist_id");
  }
}

代码示例来源:origin: aa112901/remusic

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  if (getArguments() != null) {
    albumID = getArguments().getLong("album_id");
  }
}

相关文章

Bundle类方法