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

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

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

Intent.getCharSequenceExtra介绍

暂无

代码示例

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

@Override
protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 if (getFragmentManager().findFragmentById(android.R.id.content)==null) {
  String title=getIntent().getStringExtra(EXTRA_TITLE);
  CharSequence text=getIntent().getCharSequenceExtra(EXTRA_TEXT);
  EditorFragment f=EditorFragment.newInstance(title, text);
  getFragmentManager()
    .beginTransaction()
    .add(android.R.id.content, f)
    .commit();
  String appTitle=getString(R.string.editor_activity_title_prefix)+title;
  setTitle(appTitle);
  if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
   setTaskDescription(buildTaskDesc(appTitle));
  }
 }
}

代码示例来源:origin: android-hacker/VirtualXposed

CharSequence title = intent.getCharSequenceExtra(Intent.EXTRA_TITLE);
if (title == null) {
  title = getString(R.string.choose);

代码示例来源:origin: k9mail/k-9

CharSequence text = intent.getCharSequenceExtra(Intent.EXTRA_TEXT);

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

Compat compat = CompatHelper.getCompat();
if (intent.getAction() == compat.ACTION_PROCESS_TEXT) {
  CharSequence search = intent.getCharSequenceExtra(compat.EXTRA_PROCESS_TEXT);
  if (search != null && search.length() != 0) {
    Timber.d("CardBrowser :: Called with search intent: %s", search.toString());

代码示例来源:origin: com.google.android/support-v4

/**
 * Get the literal text shared with the target activity.
 *
 * @return Literal shared text or null if none was supplied
 * @see Intent#EXTRA_TEXT
 */
public CharSequence getText() {
  return mIntent.getCharSequenceExtra(Intent.EXTRA_TEXT);
}

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

public class MyBroadcastReceiver extends BroadcastReceiver{

@Override
public void onReceive(Context context, Intent intent) {
  // TODO Auto-generated method stub

  // Extract data included in the Intent
  CharSequence intentData = intent.getCharSequenceExtra("message");   
  Toast.makeText(context, "Javacodegeeks received the Intent's message: "+intentData,    Toast.LENGTH_LONG).show();
}

}

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

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class MyBroadcastReceiver extends BroadcastReceiver{

  @Override
  public void onReceive(Context context, Intent intent) {
    // TODO Auto-generated method stub

    // Extract data included in the Intent
    CharSequence intentData = intent.getCharSequenceExtra("message");   
    Toast.makeText(context, "Received the Intent's message: "+intentData, Toast.LENGTH_LONG).show();
  }

}

代码示例来源:origin: kingargyle/adt-leanback-support

/**
 * Get the literal text shared with the target activity.
 *
 * @return Literal shared text or null if none was supplied
 * @see Intent#EXTRA_TEXT
 */
public CharSequence getText() {
  return mIntent.getCharSequenceExtra(Intent.EXTRA_TEXT);
}

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

Intent iscool = getIntent();
 if (iscool.getCharSequenceExtra("Card Number") != null) {
 final TextView setmsg = (TextView)findViewById(R.id.resultTextView);
 setmsg.setText(iscool.getCharSequenceExtra("Card Number"));             
 }

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

Intent is = getIntent();
if (is.getCharSequenceExtra("Card Number") != null) {
  final TextView setmsg = (TextView)findViewById(R.id.saleRccn);
  setmsg.setText(is.getStringExtra("Card Number"));             
}

代码示例来源:origin: skjolber/external-nfc-api

@Override
protected void onExternalNfcReaderClosed(Intent intent) {
  if(intent.hasExtra(NfcReader.EXTRA_READER_STATUS_CODE)) {
    Log.d(TAG, "Disconnect status code " + intent.getIntExtra(NfcReader.EXTRA_READER_STATUS_CODE, -1));
  }
  if(intent.hasExtra(NfcReader.EXTRA_READER_STATUS_MESSAGE)) {
    Log.d(TAG, "Disconnect status message " + intent.getCharSequenceExtra(NfcReader.EXTRA_READER_STATUS_MESSAGE));
  }
}

代码示例来源:origin: skjolber/external-nfc-api

@Override
protected void onExternalNfcReaderClosed(Intent intent) {
  if(intent.hasExtra(NfcReader.EXTRA_READER_STATUS_CODE)) {
    Log.d(TAG, "Disconnect status code " + intent.getIntExtra(NfcReader.EXTRA_READER_STATUS_CODE, -1));
  }
  if(intent.hasExtra(NfcReader.EXTRA_READER_STATUS_MESSAGE)) {
    Log.d(TAG, "Disconnect status message " + intent.getCharSequenceExtra(NfcReader.EXTRA_READER_STATUS_MESSAGE));
  }
  setReaderOpen(false);
}

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

public static CharSequence getCharSequenceExtra(Intent intent, String name) {
  if (intent != null || !hasExtra(intent, name)) return null;
  return intent.getCharSequenceExtra(name);
}

代码示例来源:origin: maoni-app/maoni

private void setAppRelatedInfo() {
  final Intent intent = getIntent();
  final CharSequence callerActivity = intent.getCharSequenceExtra(CALLER_ACTIVITY);
  mAppInfo = new Feedback.App(
      callerActivity != null ? callerActivity : getClass().getSimpleName(),
      intent.hasExtra(APPLICATION_INFO_BUILD_CONFIG_DEBUG) ?
          intent.getBooleanExtra(APPLICATION_INFO_BUILD_CONFIG_DEBUG, false) : null,
      intent.getStringExtra(APPLICATION_INFO_PACKAGE_NAME),
      intent.getIntExtra(APPLICATION_INFO_VERSION_CODE, -1),
      intent.getStringExtra(APPLICATION_INFO_BUILD_CONFIG_FLAVOR),
      intent.getStringExtra(APPLICATION_INFO_BUILD_CONFIG_BUILD_TYPE),
      intent.hasExtra(APPLICATION_INFO_VERSION_NAME) ?
          intent.getStringExtra(APPLICATION_INFO_VERSION_NAME) : null);
}

代码示例来源:origin: morogoku/MTweaks-KernelAdiutorMOD

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  if (resultCode == 0 && data != null) {
    CharSequence text = data.getCharSequenceExtra(EditorActivity.TEXT_INTENT);
    if (text != null) {
      mCodeViews.get(mSettings.get(requestCode)).resetTest();
      mCodeViews.get(mSettings.get(requestCode)).setCode(text.toString().trim());
      showFab();
    }
  }
}

代码示例来源:origin: ianhanniballake/TripleSolitaire

/**
 * Create a new instance of WinDialogFragment given the Intent created by createDataIntent
 *
 * @param data Intent created by createDataIntent()
 * @return A valid instance of WinDialogFragment
 */
public static WinDialogFragment createInstance(final Intent data) {
  WinDialogFragment winDialogFragment = new WinDialogFragment();
  Bundle args = new Bundle();
  args.putCharSequence(GAME_WIN_TIME, data.getCharSequenceExtra(GAME_WIN_TIME));
  args.putInt(GAME_WIN_MOVE_COUNT, data.getIntExtra(GAME_WIN_MOVE_COUNT, 0));
  winDialogFragment.setArguments(args);
  return winDialogFragment;
}

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

public static CharSequence getCharSequenceExtra(Intent intent, String name) {
  if (!hasIntent(intent) || !hasExtra(intent, name)) return null;
  return intent.getCharSequenceExtra(name);
}

代码示例来源:origin: morogoku/MTweaks-KernelAdiutorMOD

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  if (data == null) return;
  if (requestCode == 0) {
    Initd.write(mEditInitd, data.getCharSequenceExtra(EditorActivity.TEXT_INTENT).toString());
    reload();
  } else if (requestCode == 1) {
    Initd.write(mCreateName, data.getCharSequenceExtra(EditorActivity.TEXT_INTENT).toString());
    mCreateName = null;
    reload();
  }
}

代码示例来源:origin: li2/learning-android-open-source

/**
 * Perform a switch to the app.  A new activity stack is started, replacing
 * whatever is currently running, and this activity is finished.
 */
void switchToApp() {
  // We will launch the app showing what the user picked.  In this simple
  // example, it is just what the notification gave us.
  CharSequence from = getIntent().getCharSequenceExtra(IncomingMessageView.KEY_FROM);
  CharSequence msg = getIntent().getCharSequenceExtra(IncomingMessageView.KEY_MESSAGE);
  // Build the new activity stack, launch it, and finish this UI.
  Intent[] stack = IncomingMessage.makeMessageIntentStack(this, from, msg);
  startActivities(stack);
  finish();
}

代码示例来源:origin: morogoku/MTweaks-KernelAdiutorMOD

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_editor);
  initToolBar();
  String title = getIntent().getStringExtra(TITLE_INTENT);
  if (title != null) {
    getSupportActionBar().setTitle(title);
  }
  CharSequence text = getIntent().getCharSequenceExtra(TEXT_INTENT);
  mEditText = findViewById(R.id.edittext);
  if (text != null) {
    mEditText.append(text);
  }
}

相关文章

Intent类方法