private void SetupChat() { Log.Debug(TAG, "SetupChat()"); // Initialize the array adapter for the conversation thread conversationArrayAdapter = new ArrayAdapter <string> (this, Resource.Layout.message); conversationView = FindViewById <ListView> (Resource.Id.@in); conversationView.Adapter = conversationArrayAdapter; // Initialize the compose field with a listener for the return key //outEditText = FindViewById<EditText> (Resource.Id.edit_text_out); // The action listener for the EditText widget, to listen for the return key //outEditText.EditorAction += delegate(object sender, TextView.EditorActionEventArgs e) { // If the action is a key-up event on the return key, send the message //if (e.ActionId == ImeAction.ImeNull && e.Event.Action == KeyEventActions.Up) { //var message = new Java.Lang.String (((TextView) sender).Text); //SendMessage (message); //} //}; // Initialize the send button with a listener that for click events //sendButton = FindViewById<Button> (Resource.Id.button_send); //sendButton.Click += delegate(object sender, EventArgs e) { // Send a message using content of the edit text widget //var view = FindViewById<TextView> (Resource.Id.edit_text_out); //var message = new Java.Lang.String (view.Text); //SendMessage (message); //}; // Initialize the BluetoothChatService to perform bluetooth connections chatService = new BluetoothChatService(this, new MyHandler(this)); // Initialize the buffer for outgoing messages outStringBuffer = new StringBuffer(""); }
public AcceptThread(BluetoothChatService service) { _service = service; BluetoothServerSocket tmp = null; // Create a new listening server socket try { tmp = _service._adapter.ListenUsingRfcommWithServiceRecord(NAME, MY_UUID); } catch (Java.IO.IOException e) { Log.Error(TAG, "listen() failed", e); } mmServerSocket = tmp; }
public ConnectThread(BluetoothDevice device, BluetoothChatService service) { mmDevice = device; _service = service; BluetoothSocket tmp = null; // Get a BluetoothSocket for a connection with the // given BluetoothDevice try { tmp = device.CreateRfcommSocketToServiceRecord(MY_UUID); } catch (Java.IO.IOException e) { Log.Error(TAG, "create() failed", e); } mmSocket = tmp; }