Activity setIntent - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Activity setIntent method.

This code example shows how to use the following methods:getIntent, setIntent
     * the app can recognize (i.e. a normal {@link Intent#ACTION_VIEW} intent). 
     */ 
    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    public static void tryUpdateIntentFromBeam(Activity activity) {
        if (UIUtils.hasICS()) { 
            Intent originalIntent = activity.getIntent();
            if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(originalIntent.getAction())) {
                Parcelable[] rawMsgs = originalIntent.getParcelableArrayExtra(
                        NfcAdapter.EXTRA_NDEF_MESSAGES);
                NdefMessage msg = (NdefMessage) rawMsgs[0];
                // Record 0 contains the MIME type, record 1 is the AAR, if present. 
                // In iosched, AARs are not present. 
                NdefRecord mimeRecord = msg.getRecords()[0];
                if (ScheduleContract.Sessions.CONTENT_ITEM_TYPE.equals( 
                        new String(mimeRecord.getType()))) {
                    // Re-set the activity's intent to one that represents session details. 
                    Intent sessionDetailIntent = new Intent(Intent.ACTION_VIEW,
                            Uri.parse(new String(mimeRecord.getPayload())));
                    activity.setIntent(sessionDetailIntent);
                } 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getIntent, setIntent
     * the app can recognize (i.e. a normal {@link Intent#ACTION_VIEW} intent). 
     */ 
    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    public static void tryUpdateIntentFromBeam(Activity activity) {
        if (UIUtils.hasICS()) { 
            Intent originalIntent = activity.getIntent();
            if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(originalIntent.getAction())) {
                Parcelable[] rawMsgs = originalIntent.getParcelableArrayExtra(
                        NfcAdapter.EXTRA_NDEF_MESSAGES);
                NdefMessage msg = (NdefMessage) rawMsgs[0];
                // Record 0 contains the MIME type, record 1 is the AAR, if present. 
                // In iosched, AARs are not present. 
                NdefRecord mimeRecord = msg.getRecords()[0];
                if (ScheduleContract.Sessions.CONTENT_ITEM_TYPE.equals( 
                        new String(mimeRecord.getType()))) {
                    // Re-set the activity's intent to one that represents session details. 
                    Intent sessionDetailIntent = new Intent(Intent.ACTION_VIEW,
                            Uri.parse(new String(mimeRecord.getPayload())));
                    activity.setIntent(sessionDetailIntent);
                } 

6
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Activity setIntent Questions & Answers:

Other Activity setIntent Examples

30:		@Override
31:		protected void onNewIntent(Intent intent) {
32:			setIntent(intent);
33:			handleIntent(intent);
34:		}

Read More

setIntent Method Overview
Change the intent returned by getIntent().
See Code Examples for other Android Activity Methods: