a.alharazi a.alharazi - 1 year ago 92
Android Question

Android: passing data between activities

I have app with two activities. The first one (Bluetooth Activity) is to search for Bluetooth devices and connect with them (Working fine). The second (Control Activity) have a control buttons. Each button suppose to send command via Bluetooth.

The problem is:
1. When I use Intent it pass date from "Control Activity" to "Bluetooth Activity", but also change the view to "Bluetooth Activity" which I don't want.

2.I have multiple command in "Control Activity", if I use "intent.putExtra" it's need to insert a KEY. How to find which key is sent.

"Control Activity"

Intent intent = new Intent(this,Bluetooth.class);
intent.putExtra("blue", "b");

"Bluetooth Activity"


Answer Source

You could also use Shared Preferences

Android Shared Preferences

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download