私はAndroidのアプリを書いています。このアプリには画像と簡単な説明が表示されています。現在、YouTubeチュートリアルを使って情報を取得しています。jsonの画像データを解析する
何らかの理由でJSON
を正しく解析できず、画像と情報を表示できません。
任意の助けをいただければ幸い、ここに私のJSON
形式です:
そして、この:
秒1は、現在values/strings.xml
内の私のプロジェクトに座っている:
<string name="gallery_feed">https://gist.githubusercontent.com/draskomikic/372a8ca88d6d88ec2e45/raw/e95badd14bf24abc1b7a6dfdf4a8070515650eca</string>
これはJSON
例で動作します:
.../com.tutsplus.zoo E/Zoo: https://raw.githubusercontent.com/PaulTR/GettingStartedWithAndroid/master/images/gallery/thumbnail_grizzly.jpg
しかし、私は私が
.../com.tutsplus.zoo E/Zoo: Retrofit error 404 Not Found
を作り、これはJSON
public class GalleryImage {
private String thumbnail;
private String image;
private String caption;
public GalleryImage() {
}
public GalleryImage(String thumbnail, String image, String caption) {
this.thumbnail = thumbnail;
this.image = image;
this.caption = caption;
}
public String getThumbnail() {
return thumbnail;
}
public void setThumbnail(String thumbnail) {
this.thumbnail = thumbnail;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
}
取得するためのコードであるJSONで何を得ますインターフェイスクラス:
public interface GalleryApiInterface {
@GET("/Gallery")
void getStreams(Callback<List<GalleryImage>> callback);
}
ありがとうございます。
リンクは404を返します..あなたは、あなたのモデルに直接JSONをマッピングするためにGsonを使用することができますし、それを使うのは非常に簡単です。 –
と私はそれを修正する方法は? gist.github.comに何か提案をアップロードしましたか?よくそれはあなたがそれを初期化するときに改造する渡しているURLは何ですか?古いが、私はこの1つを入力して、まだ何も https://gist.githubusercontent.com/fernandopuma/e96b9225d8386c293a2eb029a0c4ec4d/raw/eba2646e82af618c32edc6d41be01d78a42080cd/gallery.json –
ましたか –