package com.example.application;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import com.example.androidtablayout.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
public class PhotosActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
String htmlCode = "";
Document doc;
try {
//Problem start
doc = Jsoup.connect("http://www.example.com/").get();
Element content = doc.select("a").first();
String variable = content.text();
// Problem end
TextView t = new TextView(this);
t=(TextView)findViewById(R.id.textView3);
t.setText(variable);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
super.onCreate(savedInstanceState);
setContentView(R.layout.photos_layout);
}
}
My problem is with JSoup framework. Between of "Problem" lines. I take the "Unexpectedly Stopped Error".
When I put the "htmlCode" variable like this
t.SetText(htmlCode);
It is work but i get all of html source code .
What is the main problem , i can't get it.