March 2013
Beginner to intermediate
580 pages
16h 11m
English
You are going to have one class handle the networking in PhotoGallery. Create a new Java class. Since you will be connecting to Flickr, name this class FlickrFetchr.
FlickrFetchr will start off small with only two methods: getUrlBytes(String) and getUrl(String). The getUrlBytes(String) method fetches raw data from a URL and returns it as an array of bytes. The getUrl(String) method converts the result from getUrlBytes(String) to a String.
In FlickrFetchr.java, add implementations for getUrlBytes(String) and getUrl(String) (Listing 26.3).
Listing 26.3 Basic networking code (FlickrFetchr.java)
package com.bignerdranch.android.photogallery;
...
public class FlickrFetchr {
byte[] getUrlBytes(String urlSpec) throws IOException ...Read now
Unlock full access