Example usage for android.content Intent setClassName

List of usage examples for android.content Intent setClassName

Introduction

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

Prototype

public @NonNull Intent setClassName(@NonNull String packageName, @NonNull String className) 

Source Link

Document

Convenience for calling #setComponent with an explicit application package name and class name.

Usage

From source file:org.openremote.android.console.Main.java

/**
 * Forward to settings view.//from w  ww.  j  a  v  a2  s . com
 */
private void doSettings() {
    Intent i = new Intent();
    i.setClassName(this.getClass().getPackage().getName(), AppSettingsActivity.class.getName());
    startActivity(i);
    finish();
}

From source file:ti.notifications.TiNotificationsModule.java

public PendingIntent pendingIntentLauncherApp(String className, int notificationId, String packageName,
        String source) {/*from  w w  w  . j a  v  a  2 s .  c om*/
    Context context = TiApplication.getInstance().getApplicationContext();
    Intent notificationIntent = new Intent("action" + notificationId);

    notificationIntent.setClassName(context, className);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    notificationIntent.setPackage(packageName);

    notificationIntent.putExtra("ntfId", notificationId);
    notificationIntent.putExtra("notifications", notificationId);
    notificationIntent.putExtra("source", source);

    PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);

    return pendingIntent;
}

From source file:com.agilepush.client.SkyMqttCallbackHandler.java

/**
 * @see org.eclipse.paho.client.mqttv3.MqttCallback#connectionLost(java.lang.Throwable)
 *//*from  ww w .j  av a 2 s  .c  om*/
@Override
public void connectionLost(Throwable cause) {
    // cause.printStackTrace();
    if (cause != null) {
        // format string to use a notification text
        Object[] args = new Object[2];
        args[0] = this.clientId;
        args[1] = this.host;

        String message = context.getString(R.string.connection_lost, args);

        // build intent
        Intent intent = new Intent();
        intent.setClassName(context, "com.skypush.demo.PushActivity");
        intent.putExtra("handle", clientHandle);

        // notify the user
        notifcation(message, intent, R.string.notifyTitle_connectionLost);
    }
}

From source file:dk.dtu.imm.datacollector.MainPipeline.java

public void runProbeOnceNow(final String probeName) {
    FunfConfig config = getMainConfig(this);
    ArrayList<Bundle> updatedRequests = new ArrayList<Bundle>();
    Bundle[] existingRequests = config.getDataRequests(probeName);
    if (existingRequests != null) {
        for (Bundle existingRequest : existingRequests) {
            updatedRequests.add(existingRequest);
        }/*from   w w  w. j ava 2 s  .c  o m*/
    }

    Bundle oneTimeRequest = new Bundle();
    oneTimeRequest.putLong(Probe.Parameter.Builtin.PERIOD.name, 0L);
    updatedRequests.add(oneTimeRequest);

    Intent request = new Intent(Probe.ACTION_REQUEST);
    request.setClassName(this, probeName);
    request.putExtra(Probe.CALLBACK_KEY, getCallback());
    request.putExtra(Probe.REQUESTS_KEY, updatedRequests);
    startService(request);
}

From source file:com.firebase.jobdispatcher.ExternalReceiver.java

@NonNull
private Intent createBindIntent(JobParameters jobParameters) {
    Intent execReq = new Intent(JobService.ACTION_EXECUTE);
    execReq.setClassName(this, jobParameters.getService());
    return execReq;
}

From source file:com.agilepush.client.SkyMqttCallbackHandler.java

/**
 * @see org.eclipse.paho.client.mqttv3.MqttCallback#messageArrived(java.lang.String,
 *      org.eclipse.paho.client.mqttv3.MqttMessage)
 *///from   w ww  .java 2  s. co m
@Override
public void messageArrived(String topic, MqttMessage message) throws Exception {

    // create arguments to format message arrived notifcation string
    String[] args = new String[2];
    args[0] = new String(message.getPayload());
    args[1] = topic + ";qos:" + message.getQos() + ";retained:" + message.isRetained();

    // get the string from strings.xml and format
    // String messageString = context.getString(R.string.messageRecieved,
    // (Object[]) args);

    // create intent to start activity
    Intent intent = new Intent();
    intent.setClassName(context, "com.skypush.demo.PushActivity");
    intent.putExtra("handle", clientHandle);

    // format string args
    Object[] notifyArgs = new String[3];
    notifyArgs[0] = clientId;
    notifyArgs[1] = new String(message.getPayload());
    notifyArgs[2] = topic;

    // notify the user
    notifcation(context.getString(R.string.notification, notifyArgs), intent, R.string.notifyTitle);

    // update client history
    // c.addAction(messageString);

}

From source file:com.acdd.homelauncher.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        Intent mDelye = new Intent();
        mDelye.setClassName(this, "com.acdd.android.appcenter.main.GcContainerActivity");
        startActivity(mDelye);//from w w w .  ja v a  2 s . c  om

        return true;
    } else if (id == R.id.action_updateQR) {
        File file = new File("/sdcard/app-debug.apk");
        if (!file.exists()) {

            Toast.makeText(MainActivity.this, "QRCode Update  pkg not exist", Toast.LENGTH_SHORT).show();
        }
        try {
            ACDD.getInstance().updateBundle("cn.acdd.qrcode", file);
        } catch (BundleException e) {
            e.printStackTrace();
        }
    } else if (id == R.id.action_about) {

        AlertDialog.Builder mBuild = new AlertDialog.Builder(this);
        mBuild.setTitle("About");
        mBuild.setMessage("Home Version:1.0\nACDDCore ver:" + getVersionName() + "\n" + "ACDDCore build:"
                + getVersionCode() + "\n" + "Launcher Version:" + getLauncherVerName());
        mBuild.create().show();

    } else if (id == R.id.action_nativeFragment) {
        startActivity(new Intent(this, NativeFragmentActivity.class));
    } else if (id == R.id.action_daemon) {
        startService(new Intent(this, DaemonService.class));
        Toast.makeText(MainActivity.this, "DaemonService started", Toast.LENGTH_SHORT).show();
        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:org.mariotaku.twidere.fragment.ExtensionsListFragment.java

private boolean openSettings(final ExtensionInfo info) {
    if (info == null || info.settings == null)
        return false;
    final Intent intent = new Intent(INTENT_ACTION_EXTENSIONS);
    intent.setClassName(info.pname, info.settings);
    try {/*from   w w w  .j  a  v a  2s .  c o  m*/
        startActivity(intent);
    } catch (final Exception e) {
        Log.w(LOGTAG, e);
        return false;
    }
    return true;
}

From source file:com.kawakawaplanning.rssreader.Main.MainActivity.java

public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menuitem1:
        Intent intent = new Intent();
        intent.setClassName("com.kawakawaplanning.rssreader",
                "com.kawakawaplanning.rssreader.Edit.EditActivity");
        startActivity(intent);// w  w w.  j  av a2  s .  c o  m
        finish();
        break;
    case R.id.menuitem4:
        check();
        break;
    case R.id.menuitem5:
        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
        LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.opensourcelicense, (ViewGroup) findViewById(R.id.rootLayout));
        setSpannableString(view);
        alertDialogBuilder.setTitle("");
        alertDialogBuilder.setView(view);
        alertDialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {

            }
        });
        alertDialogBuilder.setCancelable(true);
        AlertDialog alertDialog = alertDialogBuilder.create();
        alertDialog.show();
        break;
    }
    return false;
}

From source file:org.acdd.launcher.welcome.WelcomeFragment.java

public void gotoMainActivity(boolean z) {
    System.out.println("WelcomeFragment.gotoMainActivity()");
    if (start) {/*from   w w  w .  j a v a 2 s  . co  m*/
        start = true;

        return;
    }

    //  boolean z2 = false;.//com.openatlas.homelauncher.MainActivity
    if (getActivity() != null && LauncherActivity.class == getActivity().getClass()) {

        Intent mIntent = new Intent();
        mIntent.setClassName(getActivity(), "com.acdd.homelauncher.MainActivity");
        mIntent.putExtra("aa", new AA());
        startActivity(mIntent);
        LauncherActivity.doLaunchoverUT();
        getActivity().finish();
    } else {
        Log.e(getClass().getSimpleName(), "getActivity() is null");
    }
}