Reputation: 11
package com.FlickrView;
import android.app.Activity;
import android.os.Bundle;
import java.net.*;
import java.io.*;
public class FlickrView extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try {
URL flickr = new URL("http://api.flickr.com/services/feeds/photos_public.gne?id=39350419@N06&lang=en-us&format=rss_200");
URLConnection flickrConnect = flickr.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(flickrConnect.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
catch (MalformedURLException e) {
System.out.println("Unable to load URL");
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Upvotes: 1
Views: 196
Reputation: 284796
Because you have Hello, World in your GUI files. Look at res/layout/main.xml
and res/values/strings.xml
. When you pass in R.layout.main
(an int), the corresponding view is loaded from main.xml, which depends on strings.xml.
Upvotes: 4
Reputation: 39604
I'm quite sure because you have the default main.xml layout. In this default layout there is a TextView in a LinearLayout . The TextViews text is set to "Hello World, yourApplicationName".
You have to do something with your GUI in order to get anything displayed.
EDIT: System.out.println will redirect everything to your Android log. You can view the log using Logcat.
Upvotes: -1