Jun 15 | 7:25 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Jun 15 | 7:35 PM |
Wari | has entered the room |
Mark M. |
hello, Wari!
|
Mark M. |
how can I help you today?
|
Wari |
Hi there, quick question. Will Kotlin be covered as part of a track?
|
Mark M. |
I am not sure what you mean by "track"
|
Mark M. |
I have no plans on covering Kotlin in my book, insofar as that would take another book :-)
|
Wari |
The other part of the book I mean, like scripting, etc
|
Mark M. |
no, sorry
|
Mark M. |
in fact, I will be pulling a lot of the scripting stuff in the next book update, as it is old and stale at this point
|
Mark M. |
I might reintroduce it later, when I have time to update it properly
|
Mark M. |
but even with the scripting stuff, the focus is on the integration of a scripting language, not the language itself
|
Wari |
Got it. Anyway, thanks, that's all I need to know :) GTG and thanks again Mark.
|
Mark M. |
Kotlin is not a scripting language, so it wouldn't fit there
|
Wari |
Yeah
|
Mark M. |
you're welcome!
|
Wari |
Bye
|
Wari | has left the room |
Jun 15 | 7:40 PM |
Chandra S. | has entered the room |
Mark M. |
hello, Chandra
|
Mark M. |
how can I help you today?
|
Chandra S. |
Hi Murphy
|
Jun 15 | 7:45 PM |
Chandra S. |
I'm currently still confused whether choosing Retrofit or Volley
|
Chandra S. |
Do you have any advise?
|
Mark M. |
IMHO, they are not really directly comparable
|
Mark M. |
OkHttp+Picasso would be a better comparison with Volley
|
Mark M. |
Retrofit is specifically for REST-style Web service APIs
|
Mark M. |
Volley has light support for that, but not nearly as much as Retrofit offers
|
Mark M. |
personally, I use the Square libraries (OkHttp/Retrofit/Picasso)
|
Chandra S. |
I see, thanks for the opinion, Mark
|
Chandra S. |
Is there any significance difference between retrofit 1 and 2?
|
Chandra S. |
Since what's there in the book is the retrofit 1 only
|
Mark M. |
I am slightly behind on Retrofit :-(
|
Mark M. |
IIRC, it is fairly close to the original, but I forget the differences
|
Mark M. |
I will try to get this updated in the book in Version 7.4
|
Mark M. |
er, 7.5
|
Chandra S. |
OK, Thanks, Mark
|
Chandra S. |
I also still confuse on using retrofit
|
Jun 15 | 7:50 PM |
Chandra S. |
Some questions arised, like why we have to use interface?
|
Mark M. |
well, they code generate the implementation
|
Mark M. |
my guess is that it is easier for them to code generate an interface implementation than, say, a subclass of an abstract base class
|
Mark M. |
but, you would have to ask them for the specifics of why they made that choice
|
Mark M. |
in general, the idea is that you describe a service API, and then you get a Java object that handles all the implementation, so the API is as natural as possible
|
Mark M. |
contrast that with Volley or OkHttp, which both can talk to REST-style Web services, but where all the HTTP "plumbing" is exposed
|
Chandra S. |
I see.. quite clear, Mark
|
Chandra S. |
And since the book only mention to write 1 connection, how if we want to define 2 or more connections?
|
Chandra S. |
Put another @GET in the same interface or should be the different interface?
|
Jun 15 | 7:55 PM |
Mark M. |
if it is for the same Web service, it goes in the same interface
|
Mark M. |
I have an example of that in the data binding chapter, IIRC
|
Mark M. | |
Mark M. |
here, I have two @GET methods for StackOverflowInterface, each pointing to a different path
|
Chandra S. |
Nice one!
|
Chandra S. |
A little bit confuse about the query also
|
Mark M. |
could you be a bit more specific?
|
Chandra S. |
With the query tagged, the full link will be: api.stackoverflow.com/2.1/order=desc&...&tagged=android?
|
Mark M. |
given my Java code, yes
|
Chandra S. |
If called with the tagged android
|
Mark M. |
yes
|
Mark M. |
as I have it implemented, the tag is a parameter, so the Java code could supply a different tag (e.g., java)
|
Mark M. |
whereas sort and site are hard-coded
|
Chandra S. |
I see.. so it used for define more generic code
|
Jun 15 | 8:00 PM |
Mark M. |
basically, if your Java code does not need the parameter to be variable, you might as well just hard-code it
|
Mark M. |
the only reason I made the tags a parameter was to demonstrate using a parameter :-)
|
Mark M. |
I could have used a Spinner or something to allow you to switch between different tags, but that seemed like overkill
|
Chandra S. |
Sorry Mark, I got disconnected
|
Jun 15 | 8:05 PM |
Mark M. |
ok
|
Mark M. |
can you see past messages, or did they go away?
|
Chandra S. |
Ok understand it :-)
|
Chandra S. |
Yes I will write down again
|
Chandra S. |
About Picasso, I didn't see any URL in the load method
|
Chandra S. |
How it can get the picture?
|
Mark M. |
it gets a URL in the load() method
|
Mark M. | |
Mark M. |
in this case, it is a URL pulled from the Retrofit response
|
Chandra S. |
Ah sorry, I just saw the Stackoverflow API output
|
Chandra S. |
So the profile_image consist of image URL
|
Mark M. |
yes
|
Mark M. |
that particular detail comes from the Stack Exchange Web service API
|
Chandra S. |
And one more in the code that I still confuse is about the eventbus
|
Mark M. |
the URL could come from anywhere
|
Chandra S. |
What is the purpose of the eventbus?
|
Mark M. |
mostly, it is for communications between components of an app, such as service back to the activities
|
Chandra S. |
In the retrofit + picasso example, what did the event bus do?
|
Mark M. |
hold on...
|
Jun 15 | 8:10 PM |
Mark M. |
ah
|
Chandra S. |
OK
|
Mark M. | |
Mark M. |
when the user clicks on a question in the ListView in the QuestionsFragment, I post an event on the event bus
|
Mark M. |
that gets picked up by the activity
|
Mark M. |
which then brings up the Web page for the question in a browser
|
Mark M. | |
Mark M. |
the idea of the fragment delegating that work to the activity is a good idea
|
Mark M. |
using an event bus there... mostly, I was trying to show different uses for an event bus
|
Mark M. |
I should consider rewriting those to just use the contract pattern and call a method on the activity directly
|
Chandra S. |
I see.. OK, thanks Mark
|
Chandra S. |
Hmm but I still confuse how it can call the web page
|
Mark M. |
the activity just uses ACTION_VIEW
|
Mark M. |
the link to the Web page is part of the Stack Exchange Web service API response
|
Jun 15 | 8:15 PM |
Mark M. |
similar to the link to the question asker's avatar image
|
Chandra S. | |
Chandra S. |
Is there any line I have to notice beside Line 63?
|
Mark M. |
I don't know
|
Mark M. |
that is where the event is posted
|
Mark M. |
the line before it (61) is where we get the Item from
|
Jun 15 | 8:25 PM |
Chandra S. |
OK, Mark, I will look and see the code again first, since I think this one is a little bit difficult to me :-)
|
Chandra S. |
Maybe I will join the next session tomorrow, hopefully have understand throughly
|
Mark M. |
you may wish to review the chapter on threads, where I introduce the event bus
|
Mark M. |
there is also a dedicated chapter on event buses in the trails
|
Chandra S. |
OK, I will read that chapter
|
Chandra S. |
Since the book is very thick, so what I usually do is jump to the part that I want to implement in my application
|
Chandra S. |
Many thanks, Mark, for the explanation :-)
|
Mark M. |
you are very welcome
|
Chandra S. |
OK, I'll see you later :-)
|
Chandra S. | has left the room |
Jun 15 | 8:30 PM |
Mark M. | turned off guest access |