android.content.Intent.getLongArrayExtra()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(163)

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

Intent.getLongArrayExtra介绍

暂无

代码示例

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

@Test
public void testLongArrayExtra() throws Exception {
 Intent intent = new Intent();
 long[] array = new long[2];
 array[0] = 1L;
 array[1] = 2L;
 assertSame(intent, intent.putExtra("foo", array));
 assertEquals(1L, intent.getLongArrayExtra("foo")[0]);
 assertEquals(2L, intent.getLongArrayExtra("foo")[1]);
}

代码示例来源:origin: ankidroid/Anki-Android

@Override
protected void onCreate(Bundle savedInstanceState) {
  Timber.d("onCreate()");
  super.onCreate(savedInstanceState);
  mCardList = getIntent().getLongArrayExtra("cardList");
  mIndex = getIntent().getIntExtra("index", -1);
  if (mCardList.length == 0 || mIndex < 0 || mIndex > mCardList.length - 1) {
    Timber.e("Previewer started with empty card list or invalid index");
    finishWithoutAnimation();
    return;
  }
  showBackIcon();
  // Ensure navigation drawer can't be opened. Various actions in the drawer cause crashes.
  disableDrawerSwipe();
  startLoadingCollection();
}

代码示例来源:origin: JackWHLiu/jackknife

public static long[] getLongArrayExtra(Intent intent, String name) {
  if (intent != null || !hasExtra(intent, name)) return null;
  return intent.getLongArrayExtra(name);
}

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

@Override
public void onReceive(Context context, Intent intent) {
  
  Log.i(TAG, "Received intent: " + intent.getAction() + ", " 
      + intent.getDataString() + ", "
      + intent.getLongArrayExtra(ProviderIntents.EXTRA_AFFECTED_ROWS));
  
  String action = intent.getAction();
  
  if (action.equals(ProviderIntents.ACTION_DELETED)) {
    
    delete(context, intent);
  }
}

代码示例来源:origin: dsolonenko/financisto

public static QifExportOptions fromIntent(Intent data) {
  WhereFilter filter = WhereFilter.fromIntent(data);
  Currency currency = CurrencyExportPreferences.fromIntent(data, "qif");
  String dateFormat = data.getStringExtra(QifExportActivity.QIF_EXPORT_DATE_FORMAT);
  long[] selectedAccounts = data.getLongArrayExtra(QifExportActivity.QIF_EXPORT_SELECTED_ACCOUNTS);
  boolean uploadToDropbox = data.getBooleanExtra(QifExportActivity.QIF_EXPORT_UPLOAD_TO_DROPBOX, false);
  return new QifExportOptions(currency, dateFormat, selectedAccounts, filter, uploadToDropbox);
}

代码示例来源:origin: xiaolongonly/Ticket-Analysis

public static long[] getLongArrayExtra(Intent intent, String name) {
  if (!hasIntent(intent) || !hasExtra(intent, name)) return null;
  return intent.getLongArrayExtra(name);
}

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

long[] affectedRows = intent.getLongArrayExtra(
    ProviderIntents.EXTRA_AFFECTED_ROWS);

代码示例来源:origin: geniusgithub/AndroidDialer

/**
 * Returns the list of URIs to show.
 * <p>
 * There are two ways the URIs can be provided to the activity: as the data on the intent, or as
 * a list of ids in the call log added as an extra on the URI.
 * <p>
 * If both are available, the data on the intent takes precedence.
 */
private Uri[] getCallLogEntryUris() {
  final Uri uri = getIntent().getData();
  if (uri != null) {
    // If there is a data on the intent, it takes precedence over the extra.
    return new Uri[]{ uri };
  }
  final long[] ids = getIntent().getLongArrayExtra(EXTRA_CALL_LOG_IDS);
  final int numIds = ids == null ? 0 : ids.length;
  final Uri[] uris = new Uri[numIds];
  for (int index = 0; index < numIds; ++index) {
    uris[index] = ContentUris.withAppendedId(
        TelecomUtil.getCallLogUri(CallDetailActivity.this), ids[index]);
  }
  return uris;
}

代码示例来源:origin: retomeier/Wrox-ProfessionalAndroid-4E

long[] references = intent.getLongArrayExtra(extraNotificationFileIds);
for (long reference : references)
 if (myDownloadReference == reference) {

代码示例来源:origin: derry/delion

/**
 * Called to open a given download item that is downloaded by the android DownloadManager.
 * @param context Context of the receiver.
 * @param intent Intent from the android DownloadManager.
 */
private void openDownload(final Context context, Intent intent) {
  long ids[] =
      intent.getLongArrayExtra(DownloadManager.EXTRA_NOTIFICATION_CLICK_DOWNLOAD_IDS);
  if (ids == null || ids.length == 0) {
    DownloadManagerService.openDownloadsPage(context);
    return;
  }
  long id = ids[0];
  DownloadManager manager =
      (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
  Uri uri = manager.getUriForDownloadedFile(id);
  if (uri == null) {
    // Open the downloads page
    DownloadManagerService.openDownloadsPage(context);
  } else {
    Intent launchIntent = new Intent(Intent.ACTION_VIEW);
    launchIntent.setDataAndType(uri, manager.getMimeTypeForDownloadedFile(id));
    launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try {
      context.startActivity(launchIntent);
    } catch (ActivityNotFoundException e) {
      DownloadManagerService.openDownloadsPage(context);
    }
  }
}

代码示例来源:origin: GeoODK/collect

selectedInstanceIDs = intent.getLongArrayExtra(FormEntryActivity.KEY_INSTANCES);

代码示例来源:origin: AndBible/and-bible

/** Called when the activity is first created. */
@SuppressLint("MissingSuperCall")
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState, false);
  setContentView(R.layout.bookmark_labels);
  buildActivityComponent().inject(this);
  long[] bookmarkIds = getIntent().getLongArrayExtra(BookmarkControl.BOOKMARK_IDS_EXTRA);
  bookmarks = bookmarkControl.getBookmarksById(bookmarkIds);
  initialiseView();
}

代码示例来源:origin: TellH/AutoGo

return checkNull(intent.getShortArrayExtra(key), defValue);
} else if ("long[]".equals(type)) {
  return checkNull(intent.getLongArrayExtra(key), defValue);
} else if ("double[]".equals(type)) {
  return checkNull(intent.getDoubleArrayExtra(key), defValue);

代码示例来源:origin: termux/termux-api

int ledOffMs = intent.getIntExtra("led-off", 800);
long[] vibratePattern = intent.getLongArrayExtra("vibrate");
boolean useSound = intent.getBooleanExtra("sound", false);
boolean ongoing = intent.getBooleanExtra("ongoing", false);

代码示例来源:origin: grzegorznittner/chanu

downloadImageTargetType = DownloadImageTargetType.valueOf(intent.getStringExtra(TARGET_TYPE));
scheduleTime = intent.getLongExtra(SCHEDULE_TIME, 0);
postNos = intent.getLongArrayExtra(POST_NOS);
fileNames = intent.getStringArrayExtra(FILE_NAMES);

代码示例来源:origin: cbeyls/fosdem-companion-android

long[] eventIds = intent.getLongArrayExtra(EXTRA_EVENT_IDS);
for (long eventId : eventIds) {
  alarmManager.cancel(getAlarmPendingIntent(eventId));

相关文章

Intent类方法