@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)); } } }
CharSequence title = intent.getCharSequenceExtra(Intent.EXTRA_TITLE); if (title == null) { title = getString(R.string.choose);
CharSequence text = intent.getCharSequenceExtra(Intent.EXTRA_TEXT);
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());
/** * 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); }
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(); } }
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(); } }
/** * 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); }
Intent iscool = getIntent(); if (iscool.getCharSequenceExtra("Card Number") != null) { final TextView setmsg = (TextView)findViewById(R.id.resultTextView); setmsg.setText(iscool.getCharSequenceExtra("Card Number")); }
Intent is = getIntent(); if (is.getCharSequenceExtra("Card Number") != null) { final TextView setmsg = (TextView)findViewById(R.id.saleRccn); setmsg.setText(is.getStringExtra("Card Number")); }
@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)); } }
@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); }
public static CharSequence getCharSequenceExtra(Intent intent, String name) { if (intent != null || !hasExtra(intent, name)) return null; return intent.getCharSequenceExtra(name); }
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); }
@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(); } } }
/** * 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; }
public static CharSequence getCharSequenceExtra(Intent intent, String name) { if (!hasIntent(intent) || !hasExtra(intent, name)) return null; return intent.getCharSequenceExtra(name); }
@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(); } }
/** * 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(); }
@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); } }