List of usage examples for android.app Activity RESULT_CANCELED
int RESULT_CANCELED
To view the source code for android.app Activity RESULT_CANCELED.
Click Source Link
From source file:cat.mvmike.minimalcalendarwidget.activity.PermissionsActivity.java
@Override protected void onStart() { super.onStart(); setResult(Activity.RESULT_CANCELED); ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.READ_CALENDAR }, READ_CALENDAR_PERM);// www. j a va 2s . c o m }
From source file:com.levelmoney.velodrome.sample.VeloDialogFragment.java
@NonNull @Override/*w w w. j a va 2 s. c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { Builder b = new Builder(getActivity()); b.setTitle("Velo Dialog"); b.setMessage("Confirm or Cancel."); b.setNegativeButton(android.R.string.cancel, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { getTargetFragment().onActivityResult(getTargetRequestCode(), Activity.RESULT_CANCELED, null); dismiss(); } }); b.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { getTargetFragment().onActivityResult(getTargetRequestCode(), Activity.RESULT_OK, null); dismiss(); } }); return b.create(); }
From source file:com.commonsware.android.tuning.downloader.Downloader.java
@Override public void onHandleIntent(Intent i) { HttpGet getMethod = new HttpGet(i.getData().toString()); int result = Activity.RESULT_CANCELED; try {/*from www .j av a 2 s .c o m*/ ResponseHandler<byte[]> responseHandler = new ByteArrayResponseHandler(); byte[] responseBody = client.execute(getMethod, responseHandler); File output = new File(Environment.getExternalStorageDirectory(), i.getData().getLastPathSegment()); if (output.exists()) { output.delete(); } FileOutputStream fos = new FileOutputStream(output.getPath()); fos.write(responseBody); fos.close(); result = Activity.RESULT_OK; } catch (IOException e2) { Log.e(getClass().getName(), "Exception in download", e2); } Bundle extras = i.getExtras(); if (extras != null) { Messenger messenger = (Messenger) extras.get(EXTRA_MESSENGER); Message msg = Message.obtain(); msg.arg1 = result; try { messenger.send(msg); } catch (android.os.RemoteException e1) { Log.w(getClass().getName(), "Exception sending message", e1); } } }
From source file:com.ruesga.rview.wizard.WizardChooserFragment.java
public final void cancel() { final WizardActivity activity = ((WizardActivity) getActivity()); activity.performChooserClose(this, Activity.RESULT_CANCELED, null); }
From source file:com.victorkifer.AndroidTemplates.fragments.SignInFragment.java
private int checkInput() { int result = Activity.RESULT_OK; if (etEmail.getText() == null || etEmail.getText().length() == 0) { etEmail.setError(getString(R.string.err_email_empty)); result = Activity.RESULT_CANCELED; } else {//w ww .j a v a 2s . c o m Pattern emailPattern = Patterns.EMAIL_ADDRESS; if (!emailPattern.matcher(etEmail.getText()).matches()) { etEmail.setError(getString(R.string.err_not_an_email)); result = Activity.RESULT_CANCELED; } } if (etPassword.getText() == null || etPassword.getText().length() == 0) { etPassword.setError(getString(R.string.err_password_empty)); result = Activity.RESULT_CANCELED; } else if (etPassword.getText().length() < minPasswordLength) { etPassword.setError(getString(R.string.err_password_too_short)); result = Activity.RESULT_CANCELED; } return result; }
From source file:net.openracer.remote.DeviceListActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(LOGTAG, "on-create"); setContentView(R.layout.activity_device_list); getActionBar().setDisplayHomeAsUpEnabled(true); setResult(Activity.RESULT_CANCELED); Button scanButton = (Button) findViewById(R.id.button1); scanButton.setOnClickListener(new OnClickListener() { @Override/*w w w. jav a 2 s . c o m*/ public void onClick(View v) { if (hasBtPerms()) { Log.e(LOGTAG, "pushed"); v.setEnabled(false); discoveredDevices.clear(); doDiscovery(); } } }); pairedDevices = new ArrayAdapter<String>(this, R.layout.btdevice_list_item); discoveredDevices = new ArrayAdapter<String>(this, R.layout.btdevice_list_item); ListView discoveredListView = (ListView) findViewById(R.id.listView2); discoveredListView.setAdapter(discoveredDevices); discoveredListView.setOnItemClickListener(deviceClickListener); ListView pairedListView = (ListView) findViewById(R.id.listView1); pairedListView.setAdapter(pairedDevices); pairedListView.setOnItemClickListener(deviceClickListener); registerReceiver(receiver, new IntentFilter(BluetoothDevice.ACTION_FOUND)); registerReceiver(receiver, new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED)); btAdapter = BluetoothAdapter.getDefaultAdapter(); if (btAdapter == null) { Log.e(LOGTAG, "No bluetooth adapter"); } if (!hasBtPerms()) { Button button = (Button) findViewById(R.id.button1); button.setText("No Bluetooth permissions"); button.setEnabled(false); } if (btAdapter != null) { if (!btAdapter.isEnabled()) { Button button = (Button) findViewById(R.id.button1); button.setText("Bluetooth not enabled"); button.setEnabled(false); } Set<BluetoothDevice> sysPairedDevices = btAdapter.getBondedDevices(); if (sysPairedDevices.isEmpty()) { pairedDevices.add("No paired devices."); } else { for (BluetoothDevice pDev : sysPairedDevices) { pairedDevices.add(pDev.getName() + "\n" + pDev.getAddress()); } } } else { Button button = (Button) findViewById(R.id.button1); button.setText("No Bluetooth device"); button.setEnabled(false); } }
From source file:com.binomed.showtime.android.screen.widget.results.CineShowTimeResultsWidgetActivity.java
@Override protected CineShowTimeResultsFragment getFragment(Fragment fragmentRecycle) { setResult(Activity.RESULT_CANCELED); CineShowTimeResultsFragment resultFragment = null; if (fragmentRecycle != null) { resultFragment = (CineShowTimeResultsFragment) fragmentRecycle; } else {/*from w ww . j ava2 s . c om*/ resultFragment = new CineShowTimeResultsFragment(); } resultFragment.setNonExpendable(true); if (intentResult != null) { resultFragment.setIntentResult(intentResult); } return resultFragment; }
From source file:com.vsu.bruteremote.FileBrowser.java
/** * Called when the activity is first created. * @param savedInstanceState If the activity is being re-created from a previous * saved state, this is the state. *//*from w w w. java 2s . com*/ @Override public void onCreate(Bundle savedInstanceState) { if (D) Log.e(TAG, "+ ON CREATE +"); super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); String directory = ""; if (extras != null) { directory = extras.getString(EXTRA_STARTPATH); } // Render initial directory listing refreshData(directory); // Set result CANCELED in case the user backs out setResult(Activity.RESULT_CANCELED); }
From source file:com.djit.mixfader.sample.BaseActivity.java
/** * Handles bluetooth activation request result *//* w ww. j av a2s . c om*/ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_ENABLE_BT) { if (resultCode == Activity.RESULT_CANCELED) { // Bluetooth not enabled finish(); return; } } super.onActivityResult(requestCode, resultCode, data); }
From source file:org.liberty.android.fantastischmemo.downloader.google.SpreadsheetListScreen.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_CANCELED) { return;//from w w w .j av a 2 s . c o m } switch (requestCode) { case UPLOAD_ACTIVITY: { restartActivity(); break; } } }