android aidl nullpointer
<p>Are there anyone knows why I always get null pointer in the "myService.getMountPoint();"?</p>

<p>I think I do it almost as the same as the example on the Internet.</p>

<pre><code>public class mainActivity extends Activity {
/** Called when the activity is first created. */

private IMountService myService = null;

private ServiceConnection conn = new ServiceConnection() {
    public void onServiceConnected(ComponentName name, IBinder service) {
        // TODO Auto-generated method stub

        myService = IMountService.Stub.asInterface(service);
    }

    public void onServiceDisconnected(ComponentName name) {
        // TODO Auto-generated method stub

    }
};

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    bindService(new Intent(mainActivity.this, DeviceStatusService.class), conn,
            Context.BIND_AUTO_CREATE);
    startService(new Intent(mainActivity.this, DeviceStatusService.class));
    try {
        myService.getMountPoint();
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
</code></pre>

<p>}</p>
