android


trying to get results from youtube api via retrofit


get request endpoint method defined in api interface
#GET("youtube/v3/search")
Callback<YoutubeResponse> getYouTubeVideos(#Query("key") String apiKey,
#Query("channelId") String channelId,
#Query("part") String videoPart,
#Query("order") String videoOrder,
#Query("maxResults") int maxResults,
Callback<ChannelListResponse> callback);
Method call to get the results :
Callback <YoutubeResponse> call = apiService.getYouTubeVideos(API_KEY,
"UCjXfkj5iapKHJrhYfAF9ZGg", "snippet", "date", 20, new Callback<ChannelListResponse>() {
#Override
public void onResponse(Call<ChannelListResponse> call, Response<ChannelListResponse> response) {
Log.v("check", response.body().getEtag() + "check");
}
#Override
public void onFailure(Call<ChannelListResponse> call, Throwable t) {
}
}) ;
I am not getting results via this implementaion giving illegal stat exception .
There is some structual mistake because the log says Unable to create call adapter for retrofit2.Callbackfor method ApiInterface.getYouTubeVideos
using these additional links to implement the same . Using this reference link for help : YouTube Data API v3 search JSON response retrofit parsing error
But If keep the return type of getYouTubeVideos() as void. Then it says service method can not have void return type .
A help in this regards will be appreciated
Please correct the retofit syntax like this.
api interface,
#GET("youtube/v3/search")
Call<ChannelListResponse> getYouTubeVideos(#Query("key") String apiKey,
#Query("channelId") String channelId,
#Query("part") String videoPart,
#Query("order") String videoOrder,
#Query("maxResults") int maxResults);
Method call,
Call<ChannelListResponse> call = apiService.getYouTubeVideos(API_KEY,
"UCjXfkj5iapKHJrhYfAF9ZGg", "snippet", "date", 20);
call.enqueue(new Callback<ChannelListResponse>() {
#Override
public void onResponse(Call<ChannelListResponse>call,
Response<ChannelListResponse> response) {
Log.d(TAG, "onResponse");
}
#Override
public void onFailure(Call<ChannelListResponse>call, Throwable t) {
// Log error here since request failed
Log.e(TAG, t.toString());
}
});

Related Links

Android mute button
Reup: Notification (NPE Issue)
How to add touch event for a Layout that contains a ScrollView
Android: Getting source code from an APK file with R.java
Are Android USB drivers interchangeable?
Android: start activity from options menu
Android PreferenceActivity Locks Up
How to stream DTMF tones through my HEADPHONES?
Android/Eclipse: assistance with LogCat
how to get result value from webview?
Why is Faye not working on Android webview control?
Updating TextView using handler
Setting onclickListener for google map without overriding the previous one
Why am I getting these compilation errors in my Android application?
Android jar assets
Declaring components in Android crashes program

Categories

HOME
django
microsoftgraph
redux-form
character-encoding
mysql-workbench
serialization
devise
aws-cli
rom
jquery-ui
spring-session
gluon-mobile
crystal-lang
boto3
pattern-matching
commonjs
google-chrome-app
redis-sentinel
x-cart
dynatrace
flash-player
libusb
entitymanager
red5
google-picker
pyramid
cfml
sar
visual-glitch
imagemap
pagespeed
dataflow-diagram
tiki-wiki
surveymonkey
dst
clickjacking
installshield-le
getpixel
lint
sql-server-ce
release
recurrent-neural-network
parser-generator
plr
android-checkbox
memory-mapping
nanoc
ovf
libgphoto2
trojan
bbpress
objectscript
javafx-css
testrail
rocks
hadoop-2.7.2
preprocessor
lrs
flex4.6
jodd
ng-grid
dimension
shopping
angular-ui-typeahead
yajsw
mobiledoc-kit
tfs-workitem
pypiserver
amiga
haskell-warp
branch-and-bound
mraid
fail2ban
actionfilterattribute
adehabitathr
delayed-execution
addressing-mode
jqmodal
unix-socket
with-statement
template-deduction
multiautocompletetextview
syndicationfeed
gd-graph
breakout
scmmanager
composite-component
curb
extreme-programming
vfs
adobe-media-server
cuda-gdb
jdb
usertype
floating-point-exceptions
apache-commons-dbutils
fsevents
rmdir
photolibrary
strtod
glui
dsl-tools
xslcompiledtransform
image-capture
netbeans6.1

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App