-/*
- private void setupChat() {
- Log.d(TAG, "setupChat()");
-
- // Initialize the compose field with a listener for the return key
- mOutEditText = (EditText) findViewById(R.id.edit_text_out);
- mOutEditText.setOnEditorActionListener(mWriteListener);
-
- // Initialize the send button with a listener that for click events
- mSendButton = (Button) findViewById(R.id.button_send);
- mSendButton.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- // Send a message using content of the edit text widget
- TextView view = (TextView) findViewById(R.id.edit_text_out);
- String message = view.getText().toString();
- sendMessage(message);
- }
- });
-
- // Initialize the BluetoothChatService to perform bluetooth connections
- mChatService = new BluetoothChatService(this, mHandler);
-
- // Initialize the buffer for outgoing messages
- mOutStringBuffer = new StringBuffer("");
- }
-*/
-
- /**
- * Sends a message.
- * @param message A string of text to send.
- */
- /*
- private void sendMessage(String message) {
- // Check that we're actually connected before trying anything
- if (mChatService.getState() != BluetoothChatService.STATE_CONNECTED) {
- Toast.makeText(this, R.string.not_connected, Toast.LENGTH_SHORT).show();
- return;
- }
-
- // Check that there's actually something to send
- if (message.length() > 0) {
- // Get the message bytes and tell the BluetoothChatService to write
- byte[] send = message.getBytes();
- mChatService.write(send);
-
- // Reset out string buffer to zero and clear the edit text field
- mOutStringBuffer.setLength(0);
- mOutEditText.setText(mOutStringBuffer);
- }
- }
-
-
- // The action listener for the EditText widget, to listen for the return key
- private TextView.OnEditorActionListener mWriteListener =
- new TextView.OnEditorActionListener() {
- public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
- // If the action is a key-up event on the return key, send the message
- if (actionId == EditorInfo.IME_NULL && event.getAction() == KeyEvent.ACTION_UP) {
- String message = view.getText().toString();
- sendMessage(message);
- }
- if(D) Log.i(TAG, "END onEditorAction");
- return true;
- }
- };
- */