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:org.linesofcode.alltrack.graph.CreateGraphActivity.java
private void initializeContent() { Button okButton = (Button) findViewById(R.id.graph_detail_ok); okButton.setOnClickListener(new View.OnClickListener() { @Override//w w w .java 2 s. c o m public void onClick(View v) { createGraph(); } }); Button cancelButton = (Button) findViewById(R.id.graph_detail_cancel); cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setResult(Activity.RESULT_CANCELED, new Intent(CREATE_GRAPH_ACTION_CODE)); finish(); } }); EditText graphName = (EditText) findViewById(R.id.edit_graph_name); graphName.setOnKeyListener(new View.OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: createGraph(); return true; } } return false; } }); }
From source file:com.docd.purefm.settings.SettingsActivity.java
private void onBeforeFinish() { this.setResult(mNeedInvalidate ? Activity.RESULT_OK : Activity.RESULT_CANCELED); }
From source file:com.remobile.cordova.CordovaInterface.java
public void setActivityResultCallback(CordovaPlugin plugin) { // Cancel any previously pending activity. if (activityResultCallback != null) { activityResultCallback.onActivityResult(activityResultRequestCode, Activity.RESULT_CANCELED, null); }/*from w w w.ja va2 s . com*/ activityResultCallback = plugin; }
From source file:org.fdroid.fdroid.installer.ErrorDialogActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Intent intent = getIntent(); final String title = intent.getStringExtra(EXTRA_TITLE); final String message = intent.getStringExtra(EXTRA_MESSAGE); // hack to get theme applied (which is not automatically applied due to activity's Theme.NoDisplay ContextThemeWrapper theme = new ContextThemeWrapper(this, FDroidApp.getCurThemeResId()); final AlertDialog.Builder builder = new AlertDialog.Builder(theme); builder.setTitle(title);/* w w w . j a va2 s . c o m*/ builder.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { setResult(Activity.RESULT_OK); finish(); } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { setResult(Activity.RESULT_CANCELED); finish(); } }); builder.setMessage(message); builder.create().show(); }
From source file:com.levelmoney.velodrome.sample.VeloMainFragment.java
@OnActivityResult(value = CODE_DIALOG, resultCode = Activity.RESULT_CANCELED) public void onDialogCancel(Intent data) { Toast.makeText(getActivity(), "Canceled", Toast.LENGTH_LONG).show(); }
From source file:com.example.android.wearable.runtimepermissions.WearPermissionRequestActivity.java
public void onClickDenyPermissionRequest(View view) { Log.d(TAG, "onClickDenyPermissionRequest()"); setResult(Activity.RESULT_CANCELED); finish(); }
From source file:com.core.base.js.UploadHandler.java
public void onResult(int requestCode, int resultCode, Intent intent) { Log.d(TAG, "onActivityResult: requestCode-->" + requestCode + ",resultCode-->" + resultCode); if (resultCode == Activity.RESULT_CANCELED && !mCaughtActivityNotFoundException) { // Couldn't resolve an activity, we are going to try again so skip // this result. Log.d(TAG, "Activity.RESULT_CANCELED"); mCaughtActivityNotFoundException = false; if (mUploadMessage != null) { mUploadMessage.onReceiveValue(null); } else if (mFilePathCallback != null) { mFilePathCallback.onReceiveValue(null); }//w w w . j a v a 2 s . c o m // mHandled = true; mUploadMessage = null; mFilePathCallback = null; return; } // Uri result = intent == null || resultCode != Activity.RESULT_OK ? null : intent.getData(); // As we ask the camera to save the result of the user taking // a picture, the camera application does not return anything other // than RESULT_OK. So we need to check whether the file we expected // was written to disk in the in the case that we // did not get an intent returned but did get a RESULT_OK. If it was, // we assume that this result has came back from the camera. /* if (result == null && intent == null && resultCode == Activity.RESULT_OK) { File cameraFile = new File(mCameraFilePath); if (cameraFile.exists()) { result = Uri.fromFile(cameraFile); // Broadcast to the media scanner that we have a new photo // so it will be added into the gallery for the user. activity.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, result)); } }*/ if (resultCode == Activity.RESULT_OK && intent != null) { Uri result = intent.getData(); if (requestCode == FILE_SELECTED) { Log.d(TAG, "requestCode == FILE_SELECTED"); if (mUploadMessage != null) { mUploadMessage.onReceiveValue(result); } else if (mFilePathCallback != null) { Uri[] results = new Uri[] { result }; mFilePathCallback.onReceiveValue(results); } else { Log.d(TAG, "mUploadMessage and mFilePathCallback is null"); } // mHandled = true; } } mCaughtActivityNotFoundException = false; mUploadMessage = null; mFilePathCallback = null; }
From source file:de.escoand.readdaily.StoreActivity.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_nodrawer); billing = new BillingProcessor(getBaseContext(), getString(R.string.license_key), getString(R.string.merchant_id), this); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*www .j av a 2 s .c o m*/ toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { //onBackPressed(); setResult(Activity.RESULT_CANCELED, new Intent()); finish(); } }); getLayoutInflater().inflate(R.layout.fragment_store, (ViewGroup) findViewById(R.id.content), true); list = (ListView) findViewById(R.id.listView); list.setEmptyView(findViewById(R.id.listLoading)); listAdapter = new StoreArrayAdapter(this, billing); list.setAdapter(listAdapter); // result setResult(CODE_CONTENT_LOADED); }
From source file:com.example.android.bluetoothchat.DeviceListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // ??// w w w.jav a 2 s.c o m requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_device_list); // ????????????CANCELED setResult(Activity.RESULT_CANCELED); // ???????? Button scanButton = (Button) findViewById(R.id.button_scan); scanButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { doDiscovery(); v.setVisibility(View.GONE); } }); //??????? Button startchatButton = (Button) findViewById(R.id.button_start_chat); startchatButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { connect(); } }); // array adapters??. // ?????????????? ArrayAdapter<String> pairedDevicesArrayAdapter = new ArrayAdapter<String>(this, R.layout.device_name); mNewDevicesArrayAdapter = new ArrayAdapter<String>(this, R.layout.device_name); // ????ListView? pairedListView = (ListView) findViewById(R.id.paired_devices); pairedListView.setAdapter(pairedDevicesArrayAdapter); pairedListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); // ????????ListView? ListView newDevicesListView = (ListView) findViewById(R.id.new_devices); newDevicesListView.setAdapter(mNewDevicesArrayAdapter); newDevicesListView.setOnItemClickListener(mDeviceClickListener); // ???? IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); this.registerReceiver(mReceiver, filter); // ??? filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); this.registerReceiver(mReceiver, filter); // local Bluetooth adapter?? mBtAdapter = BluetoothAdapter.getDefaultAdapter(); // ???? Set<BluetoothDevice> pairedDevices = mBtAdapter.getBondedDevices(); // ????????ArrayAdapter?? if (pairedDevices.size() > 0) { findViewById(R.id.title_paired_devices).setVisibility(View.VISIBLE); for (BluetoothDevice device : pairedDevices) { pairedDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress()); } } else { String noDevices = getResources().getText(R.string.none_paired).toString(); pairedDevicesArrayAdapter.add(noDevices); } }
From source file:com.pindroid.activity.SaveReadLaterBookmark.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode != Constants.REQUEST_CODE_ACCOUNT_CHANGE) { Log.e(TAG, "Unsupported request code: " + requestCode); finish();/*w ww . j a v a2 s. c o m*/ } else { if (resultCode == Activity.RESULT_CANCELED) { finish(); } else if (resultCode == Activity.RESULT_OK) { app.setUsername(data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME)); handleIntent(); } } }