character matching

hi i have problems with communicating between phone and ArduinoBT.

my sketch is this:
char serial_val;

void loop()
{
if(serial_val=='a')
Serial.print("first");
if(serial_val=='b')
Serial.print("second");
}

my code on phone is this:

os=conn.openOutputStream();
os.write('a');

is=conn.openInputStream();
byte buffer[] = new byte[30];

while(true)
{
is.read(buffer);
instr = new String(buffer);
System.out.println(instr);
tracerForm.append(new StringItem(null, instr));
}

maybe is the problem that if i send 'a' arduino dont understand it because i tried to write ascii 97 or other things but nothing worked.

please give me tips

What if you just send from the Arduino to the phone without waiting for a character first? Does that work?

What if you just turn on an LED if the Arduino receives any data? Does that work?

I hope I'm not missing something, but code like this:

char serial_val;
if (serial_val == 'a')
  Serial.print("first");

is not likely to do anything. You need to actually read a character from the serial port. Something like this might work:

if (Serial.available() > 0)
{
  serial_val = Serial.read();
  if (serial_val == 'a')
... etc.

Mikal