I hope I got the solution. The application waits for Invocation response.Here is the solution
Invocation invocation = new Invocation(imageFilePath);
invocation.setAction(ContentHandler.ACTION_OPEN);
Registry _registry = Registry .getRegistry(mypackagename.myuiapplication);
_registry.setListener(responseListener);
registry.cancelGetResponse();
_registry.invoke(invocation);
private ResponseListener responseListener = new ResponseListener() {
public void invocationResponseNotify(Registry registry) {
registry.getResponse(false);
}
};