List of usage examples for org.opencv.android OpenCVLoader OPENCV_VERSION_2_4_8
String OPENCV_VERSION_2_4_8
To view the source code for org.opencv.android OpenCVLoader OPENCV_VERSION_2_4_8.
Click Source Link
From source file:com.wallerlab.compcellscope.ComputationalCellScopeMain.java
License:BSD License
/** Called when the activity is first created. */ @Override//from ww w . j a va2 s . c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_8, this, mLoaderCallback); btnMultiModeViewer = (Button) findViewById(R.id.btnMultiModeViewer); btnConnectBluetooth = (Button) findViewById(R.id.btnConnectBluetooth); btnAcquireBFScan = (Button) findViewById(R.id.btnAcquireBFScan); btnAcquireFullScan = (Button) findViewById(R.id.btnAcquireFullScan); btnAcquireMultiMode = (Button) findViewById(R.id.btnAcquireMuitimode); btnGallery = (Button) findViewById(R.id.btnGallery); connStatusTextView = (TextView) findViewById(R.id.connStatusTextView); connDeviceNameTextView = (TextView) findViewById(R.id.connDeviceNameTextView); connMACAddressTextView = (TextView) findViewById(R.id.connMACAddressTextView); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Get local Bluetooth adapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); // If the adapter is null, then Bluetooth is not supported if (mBluetoothAdapter == null) { Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show(); finish(); return; } // Create the BT service object mBluetoothService = new BluetoothService(this, mHandler); // See if we've already got an instance of the bluetooth connection going, and if so update the UI to reflect this GlobalApplicationClass BTAppClass = (GlobalApplicationClass) getApplication(); // Set the global Dataset object BTAppClass.setDataset(mDataset); if (BTAppClass.getBluetoothService() != null) { //Toast.makeText(this, "Bluetooth class is active!", Toast.LENGTH_LONG).show(); mBluetoothService = BTAppClass.getBluetoothService(); connDeviceNameTextView.setText(mBluetoothService.getDeviceName()); connMACAddressTextView.setText(mBluetoothService.getDeviceAddress()); connStatusTextView.setText("Connected to Array"); btnConnectBluetooth.setText("Disconnect from Array"); btConnection = true; } else { startBluetooth(); // Try and connect to the default class BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(defaultAddress); // Attempt to connect to the device mBluetoothService.connect(device); BTAppClass.setBluetoothService(mBluetoothService); } btnConnectBluetooth.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (btConnection) { sendData("endConnection"); stopBTService(); } else startBTService(); } }); btnAcquireBFScan.setOnClickListener(new OnClickListener() { public void onClick(View v) { startAcquireActivity("Brightfield_Scan"); } }); btnAcquireFullScan.setOnClickListener(new OnClickListener() { public void onClick(View v) { startAcquireActivity("Full_Scan"); } }); btnAcquireMultiMode.setOnClickListener(new OnClickListener() { public void onClick(View v) { startAcquireActivity("MultiMode"); } }); btnMultiModeViewer.setOnClickListener(new OnClickListener() { public void onClick(View v) { startMultiViewerActivity(); } }); btnGallery.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startGallery(); } }); btnComputeRefocus = (Button) findViewById(R.id.btnComputeRefocus); btnComputeRefocus.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mDataset.DATASET_PATH != "") new ComputeRefocusTask(ComputationalCellScopeMain.this).execute(mDataset); else chooseDatasetDirectory(); } }); }
From source file:us.cboyd.android.dicom.DcmBrowser.java
License:Open Source License
/** Called just before activity runs (after onStart). */ @Override// w w w . ja v a2 s.co m protected void onResume() { // If there isn't any external storage, quit the application. if (!ExternalIO.checkStorage()) { Resources res = getResources(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(res.getString(R.string.err_mesg_disk)) .setTitle(res.getString(R.string.err_title_disk)).setCancelable(false) .setPositiveButton(res.getString(R.string.err_close), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { DcmBrowser.this.finish(); } }); AlertDialog alertDialog = builder.create(); alertDialog.show(); // Else display data } else { mListFragment.setDir(); } OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_8, this, mLoaderCallback); super.onResume(); }