Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2012
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. // this is your main activity
  2. public class BluetoothTool extends Activity {
  3.    // this is the static property
  4.    // BluetoothConnection - is whatever class you use, doesn't matter for us
  5.    public static BluetoothConnection btc;
  6.    public void onCreate(Bundle savedInstanceState) {
  7.       super.onCreate(savedInstanceState);
  8.       btc = new BluetoothConnection();
  9.    }
  10. }
  11.  
  12. // this is another file, another activity,
  13. // but it can access directly static property of the main public
  14. public class MenuItem1Activity extends Activity {
  15.     public someMethodWhereINeedBlueTooth(String stuffToSend) {
  16.        BluetoothTool.btc.send(stuffToSend);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement