Example usage for android.content Intent setFlags

List of usage examples for android.content Intent setFlags

Introduction

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

Prototype

public @NonNull Intent setFlags(@Flags int flags) 

Source Link

Document

Set special flags controlling how this intent is handled.

Usage

From source file:com.prey.json.actions.Geofencing.java

public void stop(Context ctx, List<ActionResult> lista, JSONObject parameters) {

    Bundle bundle = new Bundle();

    bundle.putInt("type", ProxAlertActivity.STOP);

    Intent popup = new Intent(ctx, ProxAlertActivity.class);
    popup.putExtras(bundle);/*from   w w w. jav a  2 s . c o  m*/
    popup.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    ctx.startActivity(popup);

    PreyLogger.i("Finish Geofencing stop");

}

From source file:kaist.cs492c_2015.washerbrowser.MyGcmListenerService.java

private void launchPopupActivity(Context context, String datavalue) {
    Intent pupInt = new Intent(context, ShowPopup.class);
    pupInt.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    pupInt.putExtra("customdata", datavalue);
    context.getApplicationContext().startActivity(pupInt);
}

From source file:com.manning.androidhacks.hack023.BootstrapActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.bootstrap);/*from   w  w  w . java  2s .c o  m*/

    mAccountManager = AccountManager.get(this);
    Account[] accounts = mAccountManager.getAccountsByType(AuthenticatorActivity.PARAM_ACCOUNT_TYPE);

    if (accounts.length == 0) {
        // There are no androidHacks accounts! We need to create one.
        Log.d(TAG, "No accounts found. Starting login...");
        final Intent intent = new Intent(this, AuthenticatorActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
        startActivityForResult(intent, NEW_ACCOUNT);
    } else {
        // For now we assume that there's only one account.
        String password = mAccountManager.getPassword(accounts[0]);
        Log.d(TAG, "Using account with name " + accounts[0].name);
        if (password == null) {
            Log.d(TAG, "The password is empty, launching login");
            final Intent intent = new Intent(this, AuthenticatorActivity.class);
            intent.putExtra(AuthenticatorActivity.PARAM_USER, accounts[0].name);
            startActivityForResult(intent, EXISTING_ACCOUNT);
        } else {
            Log.d(TAG, "User and password found, no need for manual login");
            // The user is already logged in. Go ahead!
            startActivity(new Intent(this, MainActivity.class));
            finish();
        }
    }
}

From source file:com.prey.json.actions.Geofencing.java

public void start(Context ctx, List<ActionResult> lista, JSONObject parameters) {

    try {/*from   w  w w. j a  va  2 s  .c o m*/

        String origin = parameters.getString("origin");
        String[] centralPoints = origin.split(",");
        String longitude = centralPoints[0];
        String latitude = centralPoints[1];
        String radius = parameters.getString("radius");

        Bundle bundle = new Bundle();
        bundle.putDouble("longitude", Double.parseDouble(longitude));
        bundle.putDouble("latitude", Double.parseDouble(latitude));
        bundle.putFloat("radius", Float.parseFloat(radius));
        bundle.putInt("type", ProxAlertActivity.START);

        Intent popup = new Intent(ctx, ProxAlertActivity.class);
        popup.putExtras(bundle);
        popup.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        ctx.startActivity(popup);

        PreyLogger.i("Finish Geofencing start");

    } catch (JSONException e) {
        PreyLogger.e("Error en json:" + e.getMessage(), e);
        PreyWebServices.getInstance().sendNotifyActionResultPreyHttp(ctx,
                UtilJson.makeMapParam("start", "geofence", "failed", e.getMessage()));
    }

}

From source file:eltharis.wsn.showAllActivity.java

/**
 * Called when the activity is first created.
 *//*w w  w  .  j av a 2s . c  o m*/
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    try {
        String response = executeGET();
        showAll(response);
    } catch (Exception e) {
        Toast toast = Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG); //do debuggowania
        toast.show();
    }
    adapter = new ArrayAdapter<User>(this, android.R.layout.simple_list_item_1, users);
    setListAdapter(adapter);
    ListView lv = getListView();
    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { //nasuchiwanie, czy jaki z uytkownikw by nacinity

        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String username = ((TextView) view).getText().toString();
            Toast.makeText(getBaseContext(), username, Toast.LENGTH_SHORT).show();
            User selected = null;
            for (User u : users) {
                if (u.getUsername().equals(username)) {
                    selected = u;
                    break;
                }
            }
            if (selected != null) {
                Intent intent = new Intent(getBaseContext(), showIDActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                intent.putExtra("id", selected.getId()); //dodajemy jako Extra do intentu. S to tak jakby parametry
                getBaseContext().startActivity(intent); //zaczynamy intent
            }
        }
    });
}

From source file:com.phonegap.plugins.ExternalAppLauncher.ExternalAppLauncher.java

/**
 * launch market to certain app//from  w ww .j a  v a 2 s.  c  o m
 */
private boolean launchMarket(Context context, String packageName) {
    Log.d(pluginName, "Launch Market");
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("market://details?id=" + packageName));
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    Boolean result = false;
    try {
        context.startActivity(intent);
        result = true;
    } catch (Exception ex) {
        Log.d(pluginName, ex.getMessage());
        result = false;
    }
    return result;
}

From source file:com.phonegap.plugins.pdfViewer.PdfViewer.java

public String showPdf(String fileName) {

    File file = new File(fileName);

    if (file.exists()) {
        try {/*  w w  w. ja va  2  s.  c  o  m*/
            Uri path = Uri.fromFile(file);
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(path, "application/pdf");
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

            //intent.setData(Uri.parse(fileName));
            this.ctx.startActivity(intent);
            return "";
        } catch (android.content.ActivityNotFoundException e) {
            System.out.println("PdfViewer: Error loading url " + fileName + ":" + e.toString());
            return e.toString();
        }

    } else {
        return "file not found";
    }
}

From source file:com.target.plugins.PdfViewer.java

public String showPdf(String fileName) {

    File file = new File(fileName);

    if (file.exists()) {
        try {/*from   w  w w . j  a  v  a  2 s  .c  om*/
            Uri path = Uri.fromFile(file);
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(path, "application/pdf");
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

            //intent.setData(Uri.parse(fileName));
            this.ctx.startActivity(intent);
            return "";
        } catch (android.content.ActivityNotFoundException e) {
            System.out.println("PdfViewer: Error loading url " + fileName + ":" + e.toString());
            return e.toString();
        }

    } else {
        return "file not found";
    }

}

From source file:com.jumpbyte.mobile.plugin.PdfViewer.java

public String showPdf(String fileName) {

    File file = new File(fileName);

    Log.i("PdfViewer", "open file " + fileName);
    //        if (file.exists()) {
    Log.i("PdfViewer", "file exist");
    try {//from w w  w .j a  va 2 s . c o  m
        Uri path = Uri.fromFile(file);
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(path, "application/pdf");
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

        //intent.setData(Uri.parse(fileName));
        this.ctx.startActivity(intent);
        return "";
    } catch (android.content.ActivityNotFoundException e) {
        System.out.println("PdfViewer: Error loading url " + fileName + ":" + e.toString());
        return e.toString();
    }
    /*
            }else{
               Log.i("PdfViewer", "file not exist");
               return "file not found";
            }
      */

}

From source file:id.zelory.tanipedia.activity.LoginActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (PrefUtils.ambilString(this, "nama") != null) {
        Intent intent = new Intent(LoginActivity.this, CuacaActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        startActivity(intent);/*w w  w  .ja v a2 s. c o m*/
    }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    Animation animation = AnimationUtils.loadAnimation(this, R.anim.simple_grow);
    findViewById(R.id.tanipedia).startAnimation(animation);
    findViewById(R.id.card).startAnimation(animation);
    Button login = (Button) findViewById(R.id.login);
    login.startAnimation(animation);
    login.setOnClickListener(this);
    TextView daftar = (TextView) findViewById(R.id.register);
    daftar.startAnimation(animation);
    daftar.setOnClickListener(this);
    editEmail = (EditText) findViewById(R.id.email);
    editPass = (EditText) findViewById(R.id.password);
}