I am learnign how to handle and to use functional programming in Android. So I developed the below code. I would like to handle the HandlerThread as observable, but when I try to call .start() from .map() operator I receive the following error:
no instances of type variable(s) R exists so that void conforms to R
please let me know why I am getting this error and how to solve it.
code:
public Single<HandlerThread> getObsInitializedHandlerThread() {
this.mMyHandlerThread = new MyHandlerThread(NAME_MY_HANDLER_THREAD);
return Single.just(this.mMyHandlerThread);
}
@Override
protected void onResume() {
super.onResume();
String TAG_LOG = ActMain.TAG_LOG + "." + "onResume()";
Log.v(TAG_LOG, ":");
this.getObsInitializedHandlerThread()
.map(mMyHandlerThread -> mMyHandlerThread.start());
}
private class MyHandlerThread extends HandlerThread {
public MyHandlerThread(String name) {
super(name);
String TAG_LOG = ActMain.class.getSimpleName() + "." + "MyHandlerThread() Constructor";
Log.v(TAG_LOG, ":");
}
@Override
protected void onLooperPrepared() {
super.onLooperPrepared();
String TAG_LOG = ActMain.class.getSimpleName() + "." + onLoopPrepared()";
Log.v(TAG_LOG, ":");
}
}