Example usage for android.content Intent setAction

List of usage examples for android.content Intent setAction

Introduction

In this page you can find the example usage for android.content Intent setAction.

Prototype

public @NonNull Intent setAction(@Nullable String action) 

Source Link

Document

Set the general action to be performed.

Usage

From source file:com.nadmm.airports.wx.NoaaService.java

private Intent makeResultIntent(String action, String type) {
    Intent intent = new Intent();
    intent.setAction(action);
    intent.putExtra(TYPE, type);
    return intent;
}

From source file:com.perm.DoomPlay.AbstractVkItems.java

void startListVkActivity(ArrayList<Audio> audios) {
    Intent intent = new Intent(this, ListVkActivity.class);
    intent.setAction(ListVkActivity.actionJust);
    intent.putExtra(MainScreenActivity.keyOpenInListTrack, audios);
    startActivity(intent);/* w  w w .  j a  va  2s  .  co  m*/
}

From source file:DetailActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);

    detector = new GestureDetector(this, new GalleryGestureDetector());
    listener = new View.OnTouchListener() {

        @Override/* ww  w. j av a2s.  c  o m*/
        public boolean onTouch(View v, MotionEvent event) {
            return detector.onTouchEvent(event);
        }
    };

    ImageIndex = 0;

    detailImage = (ImageView) findViewById(R.id.detail_image);
    detailImage.setOnTouchListener(listener);

    TextView detailName = (TextView) findViewById(R.id.detail_name);
    TextView detailDistance = (TextView) findViewById(R.id.detail_distance);
    TextView detailText = (TextView) findViewById(R.id.detail_text);
    detailText.setMovementMethod(new ScrollingMovementMethod());
    ImageView detailWebLink = (ImageView) findViewById(R.id.detail_web_link);

    int i = MainActivity.currentItem;
    Random n = new Random();
    int m = n.nextInt((600 - 20) + 1) + 20;
    setTitle(getString(R.string.app_name) + " - " + MainData.nameArray[i]);
    detailImage.setImageResource(MainData.detailImageArray[i]);
    detailName.setText(MainData.nameArray[i]);
    detailDistance.setText(String.valueOf(m) + " miles");
    detailText.setText(MainData.detailTextArray[i]);

    detailWebLink.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_VIEW);
            intent.addCategory(Intent.CATEGORY_BROWSABLE);
            intent.setData(Uri.parse(MainData.detailWebLink[MainActivity.currentItem]));
            startActivity(intent);
        }
    });
}

From source file:de.grobox.blitzmail.MainActivity.java

private void sendNow() {
    JSONObject mails = MailStorage.getMails(this);

    Iterator<?> i = mails.keys();

    while (i.hasNext()) {
        String mail = mails.opt((String) i.next()).toString();

        Intent intent = new Intent(this, SendActivity.class);
        intent.setAction("BlitzMailReSend");
        intent.putExtra("mail", mail);
        startActivity(intent);/*  www. j  av a 2s. c o  m*/
    }

    ((PreferenceCategory) findPreference("pref_sending")).removePreference(findPreference("pref_send_now"));
}

From source file:com.bluelinelabs.logansquare.typeconverters.IntentConverter.java

@Override
public Intent parse(JsonParser jsonParser) throws IOException {
    SimpleIntent simpleIntent = SimpleIntent$$JsonObjectMapper._parse(jsonParser);
    Intent intent = new Intent();

    android.util.Log.d("json2notification", "action:" + simpleIntent.action);
    if (simpleIntent.action != null) {
        intent.setAction(simpleIntent.action);
    }/* w w w .j a  va  2s  . c  o m*/
    android.util.Log.d("json2notification", "uri:" + simpleIntent.uri);
    if (simpleIntent.uri != null) {
        intent.setData(simpleIntent.uri);
    }
    return intent;
}

From source file:com.google.samples.apps.iosched.feedback.FeedbackHelper.java

/**
 * Invokes the {@link FeedbackWearableListenerService} to dismiss the notification on both the device
 * and wear.//w  w w . j ava  2s .  c  o  m
 */
private void dismissFeedbackNotification(String sessionId) {
    Intent dismissalIntent = new Intent(mContext, FeedbackWearableListenerService.class);
    dismissalIntent.setAction(SessionAlarmService.ACTION_NOTIFICATION_DISMISSAL);
    dismissalIntent.putExtra(SessionAlarmService.KEY_SESSION_ID, sessionId);
    mContext.startService(dismissalIntent);
}

From source file:com.doomy.decode.ResultDialogFragment.java

private void createURLIntent(String myURL) {
    Intent mIntent = new Intent();
    mIntent.setAction(Intent.ACTION_VIEW);
    mIntent.addCategory(Intent.CATEGORY_BROWSABLE);
    mIntent.setData(Uri.parse(myURL));/*from   w w w .j  a  v  a2 s.co  m*/
    startActivity(mIntent);
}

From source file:com.granita.contacticloudsync.ui.DebugInfoActivity.java

public void onShare(MenuItem item) {
    if (!TextUtils.isEmpty(report)) {
        Intent sendIntent = new Intent();
        sendIntent.setAction(Intent.ACTION_SEND);
        sendIntent.setType("text/plain");
        sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Exception Details");

        try {//w w  w  .ja v a2  s . c om
            File reportFile = File.createTempFile("debug", ".txt", getExternalCacheDir());
            Constants.log.debug("Writing debug info to " + reportFile.getAbsolutePath());
            FileWriter writer = new FileWriter(reportFile);
            writer.write(report);
            writer.close();

            sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(reportFile));
        } catch (IOException e) {
            // let's hope the report is < 1 MB
            sendIntent.putExtra(Intent.EXTRA_TEXT, report);
        }

        startActivity(sendIntent);
    }
}

From source file:be.benvd.mvforandroid.SettingsActivity.java

private void stopService() {
    Intent stop = new Intent(this, MVDataService.class);
    stop.setAction(MVDataService.STOP_SERVICE);
    WakefulIntentService.sendWakefulWork(this, stop);
}

From source file:com.netatmo.weatherstation.sample.LoginActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Intent browserIntent = new Intent();
    browserIntent.setAction(Intent.ACTION_VIEW);

    switch (item.getItemId()) {
    case R.id.action_forgot_password:
        browserIntent.setData(Uri.parse("https://auth.netatmo.com/access/lostpassword"));
        startActivity(browserIntent);//from w w w  .  j a v a 2  s  .  co m
        return true;
    case R.id.action_create_account:
        browserIntent.setData(Uri.parse("https://auth.netatmo.com/access/signup"));
        startActivity(browserIntent);
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}