Open-Weather-API-Wrapper icon indicating copy to clipboard operation
Open-Weather-API-Wrapper copied to clipboard

Please, return Observable!

Open MrVilkaman opened this issue 8 years ago • 2 comments

Why not return Observable insted callback? Callback is bad way!

MrVilkaman avatar Feb 11 '17 19:02 MrVilkaman

@MrVilkaman Is there any soecific reason for that, which I am not aware of??

kevalpatel2106 avatar Feb 12 '17 08:02 kevalpatel2106

Of course:

  1. You hold link on listener. So it is way to memory leak.

  2. You lost information about cause of error for example if I will want show snackbar when internet connection is lost (IOException or NetworkErrorException) and show alert dialog when handle simple HttpException. How I can do without instanceOf ?

  3. I want continue work with response ( save to DB, convert to other model, etc) or combine with another queries. And I want use RxJava for this. How I can do this? Use Observable.create? I think it is bad way!

MrVilkaman avatar Feb 12 '17 09:02 MrVilkaman