Question: Hello I have 3 fields on input form which are set via POST method to external php

```
 $id=$_POST['id']; 
 $nombre=$_POST['nombre']; 
 $cedula=$_POST['cedula']; 

```

where I would like to make a search option depending on which field have data inside it or if a user put data in all 3 or in only 2 fields to search from the input fields which are not NULL fields in the same table where there is a result. 

my sql query is something like that `$sql = "SELECT * FROM users WHERE userID = $id AND nombre = $nombre AND cedula = $cedula) ";`

obviosly which is not working, what should I do to make it work. Do I need to change only the query or I need to put something before it to check first what is not NULL. Thanks

Answer: 
The actual connection to the service has not yet been established despite the fact the method `bindService()` returns `true`.

Binding to a service of a different process (IPC) is asynchronous. You cannot use the service until `onServiceConnected()` has been invoked. `onStart()` is too early in that process and thats why `mService` is `null`.

This also explains why putting your code in the buttons click listener works. By the time you tap the button the connection has been established.
It looks like your `mService` object is uninitialized when you call the `getPlainText` method on it, causing a null pointer exception.

Wait to call `getPlainText` until after `mService` is initialized in `OnServiceConnected`.