user13817: I am trying to send/receive data from Android to my Arduino (via a HC-05) and later from Arduino to Android. I have configured my HC-05 as slave, and the UART=9600,0,0.... To send data from Android to Arduino I don´t have problem but to send data Arduino to Android I can not...
This is my sketch: 
char data;
int a=1;
int v=1;
#include SoftwareSerial connection(10,11);//RX|TX
void setup() 
{
 pinMode(7,OUTPUT);
 connection.begin(9600);
 digitalWrite(7,LOW);
}

void loop() 
{
 if(connection.available()>0)
 {
  data=connection.read();
   if(data=='1')
   {
    digitalWrite(7,HIGH);
    connection.write(data);
    delay(200);
   }
   //connection.write(data);
  }
 }

MY HANDLER IN THE MAIN:
       mhandler=new Handler()        {
        public void handleMessage(android.os.Message msg)            {
            switch (msg.what)
            {
                case MENSSAGESEND:
                    msg = new DriveData((BluetoothSocket)msg.obj);    //DriveData msg = new DriveData((BluetoothSocket)msg.obj);
                    break;
                case MESSAGEREADING:
                    byte[] bufferget = (byte[])msg.obj;
                    String men = new String(bufferget,0,msg.arg1);
                    sb.append(men);
                    int endline=sb.indexOf("\n");
                    if(endline>0)
                    {
                        String print=sb.substring(0,endline);
                        sb.delete(0, sb.length());
                        Toast.makeText(getApplicationContext(),"menssage"+" "+print,Toast.LENGTH_LONG).show();
                        txtData.setText(print);
                    }
                    break;

            }
        };
    };

MY METHOD FOR RECEIVER AND SEND DATA
  public void run()
    {
        byte[] wait=new byte[1024];
        int bytesReceived;
        while (true) {
            try {
                 bytesReceived=entrydata.read(wait);//entrydata is my inputstream
                mhandler.obtainMessage(MESSAGEREADING,bytesReceived,-1,wait).sendToTarget();
            }catch (IOException e){
                break;
            }
        }
    }


user16299: You are missing the line termination
you must send '\n' after your data in order to receive the data
or use 
conexion.println(entrada) 
rather then
conexion.write(entrada)

13817: <p>I am trying to send/receive data from Android to my Arduino (via a HC-05) and later from Arduino to Android. I have configured my HC-05 as slave, and the UART=9600,0,0.... To send data from Android to Arduino I don´t have problem but to send data Arduino to Android I can not...</p>

<p>This is my sketch: </p>

<pre class="lang-c prettyprint-override"><code>char data;
int a=1;
int v=1;
#include SoftwareSerial connection(10,11);//RX|TX
void setup() 
{
 pinMode(7,OUTPUT);
 connection.begin(9600);
 digitalWrite(7,LOW);
}

void loop() 
{
 if(connection.available()&gt;0)
 {
  data=connection.read();
   if(data=='1')
   {
    digitalWrite(7,HIGH);
    connection.write(data);
    delay(200);
   }
   //connection.write(data);
  }
 }
</code></pre>

<p>MY HANDLER IN THE MAIN:</p>

<pre><code>       mhandler=new Handler()        {
        public void handleMessage(android.os.Message msg)            {
            switch (msg.what)
            {
                case MENSSAGESEND:
                    msg = new DriveData((BluetoothSocket)msg.obj);    //DriveData msg = new DriveData((BluetoothSocket)msg.obj);
                    break;
                case MESSAGEREADING:
                    byte[] bufferget = (byte[])msg.obj;
                    String men = new String(bufferget,0,msg.arg1);
                    sb.append(men);
                    int endline=sb.indexOf("\n");
                    if(endline&gt;0)
                    {
                        String print=sb.substring(0,endline);
                        sb.delete(0, sb.length());
                        Toast.makeText(getApplicationContext(),"menssage"+" "+print,Toast.LENGTH_LONG).show();
                        txtData.setText(print);
                    }
                    break;

            }
        };
    };
</code></pre>

<p>MY METHOD FOR RECEIVER AND SEND DATA</p>

<pre><code>  public void run()
    {
        byte[] wait=new byte[1024];
        int bytesReceived;
        while (true) {
            try {
                 bytesReceived=entrydata.read(wait);//entrydata is my inputstream
                mhandler.obtainMessage(MESSAGEREADING,bytesReceived,-1,wait).sendToTarget();
            }catch (IOException e){
                break;
            }
        }
    }
</code></pre>
 16299: <p>You are missing the line termination
you must send '\n' after your data in order to receive the data
or use 
conexion.println(entrada) 
rather then
conexion.write(entrada)</p>
