[Solved] Exception While Connection

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

[Solved] Exception While Connection

Postby ansh.chauhan » Thu Jun 18, 2009 1:35 pm

HI Evryone I m geting exception when i m trying to connect with HttpUrl Connection
Here my code is


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. Log.v("data", "00000000");
  3.  
  4.                 String string="";
  5.  
  6.                 try {
  7.  
  8.                         Log.v("data", "1");
  9.  
  10.                         URL url = new URL("http://65.182.161.95/mobileurl/rssnews.aspx?req=1");
  11.  
  12.                         Log.v("data", "2");
  13.  
  14.                         URLConnection   conn = (HttpURLConnection) url.openConnection();
  15.  
  16.                         Log.v("data", "3");
  17.  
  18.             conn.connect();
  19.  
  20.             Log.v("data", "4");
  21.  
  22.             InputStream stream = conn.getInputStream();
  23.  
  24.             Log.v("data", "5");
  25.  
  26.             StringBuffer buffer=new StringBuffer();
  27.  
  28.             int i=0;
  29.  
  30.             while ((i=stream.read())!=-1) {
  31.  
  32.                                 buffer.append((char)i);
  33.  
  34.                                 Log.v("char", ""+(char)i);
  35.  
  36.                         }
  37.  
  38.             string=buffer.toString();
  39.  
  40.  
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


I m getting exception


Java.net.securityexception:permission denied(may be missing internet permission)
ansh.chauhan
Experienced Developer
Experienced Developer
 
Posts: 75
Joined: Tue May 27, 2008 7:04 am

Top

Postby ansh.chauhan » Thu Jun 18, 2009 2:10 pm

I got answer

just add this into ur manifest file

<uses-permission android:name="android.permission.INTERNET" />
ansh.chauhan
Experienced Developer
Experienced Developer
 
Posts: 75
Joined: Tue May 27, 2008 7:04 am

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 7 guests