[Permissions] Read a website to an TextView

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

[Permissions] Read a website to an TextView

Postby NelsonPRSousa » Sat Nov 02, 2013 2:57 am

Hi guys,

I am new here; First of all I wish you all the best and hope I can learn something with you! :)

I am with a problem: I can not read html from a website with my Android app. I think the problem is because of Internet permissions.

HttpExample (who is launched)
Code: Select all
package com.example.httpexample;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;

public class HttpExample extends Activity {

   TextView httpStuff;

   protected void onCreate(Bundle savedInstanceState) {
      httpStuff = (TextView) findViewById(R.id.tvHttp);
      GetMethodEx test = new GetMethodEx();
      String returned;
      httpStuff.setText("Debugging 1 - onCreate");
      try {
         returned = test.getInternetData();
      } catch (Exception e) {
         httpStuff.setText("Debbuging 3 - catch");

   public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.http_example, menu);
      return true;


Right here I tried to debugging and my textview get the exception from catch.

Code: Select all
package com.example.httpexample;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URI;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

public class GetMethodEx {
   public String getInternetData() throws Exception{
      BufferedReader in = null;
      String data = null;
         HttpClient client = new DefaultHttpClient();
         URI website = new URI("http://www.mybringback.com/");
         HttpGet request = new HttpGet();
         HttpResponse response = client.execute(request);
         in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
         StringBuffer sb = new StringBuffer("");
         String l = "";
         String nl = System.getProperty("line.separator");
         while((l = in.readLine()) != null){
            sb.append(l + nl);
         data = sb.toString();
         return data;
         if(in != null){
               return data;
            } catch(Exception e) {

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    android:versionName="1.0" >

        android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />

        android:theme="@style/AppTheme" >
            android:label="@string/app_name" >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />


Hope you guys can help me. Thank you.
Once Poster
Once Poster
Posts: 1
Joined: Sat Nov 02, 2013 2:55 am


Re: [Permissions] Read a website to an TextView

Postby nadirchine » Tue Nov 05, 2013 1:32 pm

how i can parse data from a site which has no RSS ?
Once Poster
Once Poster
Posts: 1
Joined: Tue Nov 05, 2013 12:52 pm


Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot] and 7 guests