1

I am trying to convert the item emitted from an observer to another type. I tried the map function with no success.

mObservable = RxTextView.textChanges(mEditText).map(a -> Float.parseFloat(a.toString()));

Using as above I get this compiler error:

Error:(37, 70) error: incompatible types: inference variable R has incompatible bounds
equality constraints: CharSequence
lower bounds: Float
where R,T are type-variables:
R extends Object declared in method <R>map(Func1<? super T,? extends R>)
T extends Object declared in class Observable

Is there any operator which can achieve the conversion CharSequence to Float I need?

thyago stall
  • 1,654
  • 3
  • 16
  • 30

1 Answers1

0

Did you try Cast() ?

  • cast( ) — cast all items from the source Observable into a particular type before reemitting them

Reference https://github.com/ReactiveX/RxJava/wiki/Transforming-Observables

Mohamed Yehia
  • 400
  • 1
  • 5
  • 15