learning android..getting IO exception in httpURL -


I'm learning Android and I'm caught in the IO block of exception. Can someone help me. Below is my code

  package com.example.blogreader; Import java.io.IOException; Import java.net.HttpURLConnection; Import java.net.MalformedURLException; Import java.net.URL; Import android.app.ListActivity; Import Android.os.AsyncTask; Importroid.os.Bundle; Import android.util.log; Import android.view.Menu; Public class manilist activity list activity (protected strings [] M hasters; public static final integer, NUMBER_OF_HOSPITALS = 20; public static final string TAG = main list activity.class.getSampleName (); @ override protected zero creation (bundle saved instenestate) { Super.naught (savedinstenstate); setContentView (R.layout.activity_main_list); // resource resources = getResources (); // m migrant = resource.getStringArray (R.array.hospital_names) ; // // Arrayedupter & lt; string & gt; adapter = new array adapter & lt; string & gt; (this, Android .R.Lite Symple_list_item_1, MH certificate); // setListAdapter (adapter); // Toast .makeText (Get it, GetString (R.string.no_hospital_fond), Toast.LnnHH_LOG). GetBlogPostsTask getBlogPostsTask = New GetBlogPostsTask (); getBlogPostsTask.execute ();} @ Override Public Boolean on Crate Option Menu (menu menu) Increasing the // // menu; it adds items to the action bar if it exists GetMenuInflater (). Flowers (R.menu.main_list, May Second); Back true; } Private Class GetBlogPostsTask AsyncTask & lt; Object, zero, string & gt; {Secure string doInBackground (object ... arg0) {int reponseCode = -1; {Try URL Hospital FeedUrl = New URL ("http://blog.teamtreehouse.com/api/get_recent_summary/?count=" + NUMBER_OF_HOSPITALS); HttpURL Connection Connection = (HttpURLConnection) Hospital FeedUrl.openConnection (); Connection.connect (); ReponseCode = connection.getResponseCode (); Log.i (tag, "code" + reponseCode); } Catch (mellemurolectionem E) {log. A (Tag, "Exception caught XX:", E); } Catch (IOE EXPRESS E) {log. A (tag, "exception io yy has been caught:", e); } Hold (exception e) {Log.e (tag, "general exception zz:", e); } Return "code" + reponseCode; Without logcat, there is a beautiful wild guess, but you may have forgotten Logitech to allow  Internet  on your  AndroidManifest.xml  

  Use of Android-permission Android: name = "android.permission.INTERNET" />  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -