I am trying to pass the BluetoothDevice Object that I acquired from MainActivity ,after my device and other device bonded, to my ExerciseActivity. But before i reach the exercise activity I have to cross to my RecyclerActivity where the recyclerView is there under the ExerciseAdapter. How can i pass the BluetoothDevice Object to my Exercise Activity? I tried passing thru intern like this.
if(action.equals(BluetoothDevice.ACTION_BOND_STATE_CHANGED)){
BluetoothDevice mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
//case 1
if(mDevice.getBondState() == BluetoothDevice.BOND_BONDED){
Log.d(TAG,"mBroadcastReceiver4: BOND_BONDED");
mBTDevice = mDevice;
Intent exerciseIntent = new Intent(MainActivity.this, RecyclerActivity.class);
exerciseIntent.putExtra("btDevice",mBTDevice);
startActivity(exerciseIntent);
}
I thought the the ExerciseAdapter can still get the extra Intent because it is inside my RecyclerActivity. How can my ExerciseAdapter get the Extra Intent coming from Recycler Activity and pass it to my ExerciseActivity? Thank you for answering.