Example usage for android.content Intent setClass

List of usage examples for android.content Intent setClass

Introduction

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

Prototype

public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls) 

Source Link

Document

Convenience for calling #setComponent(ComponentName) with the name returned by a Class object.

Usage

From source file:net.dahanne.android.google.client.GoogleActivity.java

private void displayGoogleAuthorization() {
    Intent intent = new Intent();
    intent.setClass(this, GoogleWebOAuthActivity.class);
    startActivity(intent);//from   w  w  w.  j  a  va  2  s  . c o m
    finish();
}

From source file:com.jingle.zxing.plugin.BarcodeScanner.java

/**
 * Starts an intent to scan and decode a barcode.
 *///from  www.  jav  a 2 s.  c o m
public void scan(String mode) {
    Intent intentScan = new Intent();
    intentScan.setClass(this.cordova.getActivity(), CaptureActivity.class);
    intentScan.addCategory(Intent.CATEGORY_DEFAULT);
    intentScan.putExtra(MODE, mode);

    this.cordova.startActivityForResult((CordovaPlugin) this, intentScan, REQUEST_CODE);
}

From source file:com.google.zxing.client.android.plugin.BarcodeScanner.java

/**
 * Starts an intent to scan and decode a barcode.
 * @param mode  PRODUCT_MODE | ONE_D_MODE | QR_CODE_MODE | DATA_MATRIX_MODE 
 *//*  w ww.j  a v a 2s . com*/
public void scan(String mode) {
    Intent intentScan = new Intent();
    intentScan.setClass(this.cordova.getActivity(), CaptureActivity.class);
    intentScan.addCategory(Intent.CATEGORY_DEFAULT);
    if (!mode.equals("")) {
        intentScan.putExtra(Intents.Scan.MODE, mode);
    }

    this.cordova.startActivityForResult((CordovaPlugin) this, intentScan, REQUEST_CODE);
}

From source file:org.kepennar.android.client.social.facebook.FacebookActivity.java

private void displayFacebookAuthorization() {
    Intent intent = new Intent();
    intent.setClass(this, FacebookWebOAuthActivity.class);
    startActivity(intent);//w  w  w.  j ava2s  .c o  m
    finish();
}

From source file:org.kepennar.android.client.social.twitter.TwitterActivity.java

private void displayTwitterAuthorization() {
    Intent intent = new Intent();
    intent.setClass(this, TwitterWebOAuthActivity.class);
    startActivity(intent);//from   www  . j  a  va 2 s.c o  m
    finish();
}

From source file:com.facebook.share.DeviceShareDialog.java

@Override
protected void showImpl(final ShareContent content, final Object mode) {
    if (content == null) {
        throw new FacebookException("Must provide non-null content to share");
    }/*  www  .j a  va2  s .  c o m*/

    if (!(content instanceof ShareLinkContent) && !(content instanceof ShareOpenGraphContent)) {
        throw new FacebookException(
                this.getClass().getSimpleName() + " only supports ShareLinkContent or ShareOpenGraphContent");
    }
    Intent intent = new Intent();
    intent.setClass(FacebookSdk.getApplicationContext(), FacebookActivity.class);
    intent.setAction(DeviceShareDialogFragment.TAG);
    intent.putExtra("content", content);
    startActivityForResult(intent, getRequestCode());
}

From source file:com.appdynamics.demo.gasp.activity.GaspDataActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
    // Respond to the action bar's Up/Home button
    case android.R.id.home:
        NavUtils.navigateUpFromSameTask(this);
        return true;

    case R.id.gasp_settings:
        Intent intent = new Intent();
        intent.setClass(this, SetPreferencesActivity.class);
        startActivityForResult(intent, 0);
        return true;

    default:// w w  w .  j  a  va  2 s .  c  o m
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.jesusla.google.BillingReceiver.java

/**
 * This is called when Android Market sends a server response code. The BillingService can
 * then report the status of the response if desired.
 *
 * @param context the context/*from  w ww.  j  a  va2s  .  c om*/
 * @param requestId the request ID that corresponds to a previous request
 * @param responseCodeIndex the ResponseCode ordinal value for the request
 */
private void checkResponseCode(Context context, long requestId, int responseCodeIndex) {
    Intent intent = new Intent(Consts.ACTION_RESPONSE_CODE);
    intent.setClass(context, BillingService.class);
    intent.putExtra(Consts.INAPP_REQUEST_ID, requestId);
    intent.putExtra(Consts.INAPP_RESPONSE_CODE, responseCodeIndex);
    context.startService(intent);
}

From source file:com.jesusla.google.BillingReceiver.java

/**
 * This is called when Android Market sends information about a purchase state
 * change. The signedData parameter is a plaintext JSON string that is
 * signed by the server with the developer's private key. The signature
 * for the signed data is passed in the signature parameter.
 * @param context the context/*from w ww .  ja v  a2 s. c  o m*/
 * @param signedData the (unencrypted) JSON string
 * @param signature the signature for the signedData
 */
private void purchaseStateChanged(Context context, String signedData, String signature) {
    Intent intent = new Intent(Consts.ACTION_PURCHASE_STATE_CHANGED);
    intent.setClass(context, BillingService.class);
    intent.putExtra(Consts.INAPP_SIGNED_DATA, signedData);
    intent.putExtra(Consts.INAPP_SIGNATURE, signature);
    context.startService(intent);
}

From source file:com.jesusla.google.BillingReceiver.java

/**
 * This is called when Android Market sends a "notify" message  indicating that transaction
 * information is available. The request includes a nonce (random number used once) that
 * we generate and Android Market signs and sends back to us with the purchase state and
 * other transaction details. This BroadcastReceiver cannot bind to the
 * MarketBillingService directly so it starts the {@link BillingService}, which does the
 * actual work of sending the message.//  w w  w . j  a v a 2  s  . co m
 *
 * @param context the context
 * @param notifyId the notification ID
 */
private void notify(Context context, String notifyId) {
    Intent intent = new Intent(Consts.ACTION_GET_PURCHASE_INFORMATION);
    intent.setClass(context, BillingService.class);
    intent.putExtra(Consts.NOTIFICATION_ID, notifyId);
    context.startService(intent);
}