doInBackground error when using Jsoup in Android -


I am trying to learn Android and when I was trying to parse the HTML using JSOU, I get an error and my app stops. I have a button in my layout and when I click it, let me update the textview and write the title of the HTML page. Here is the code (required parts):

  Click on Public Zero (see Arg 0) {// Todo auto generated method stub new title (). Execute (new string [] {url}); // I have a html address url as a string}} class title async task and string, zero, string & gt; {String pageTitle; Protected string doInBackground (string ... parameter) {try {document doc = jsoup.connect (params [0]). Get (); PageTitle = doc.title (); } Grip (IOException E) {// TODO Auto-Generated Catch Block e.printStackTrace (); } Return page title; } Secure zero (string ... parameter) on PasteXsecret {MainActivity.title.setText (parameter [0]); }}   

When I click on the button, it says, "Unfortunately, the app is closed."

Can anyone tell me what I am doing?

do this in doInBackground ():

  {string page title ; Element element; Protected string doInBackground (string ... parameter) {try {document doc = jsoup.connect (params [0]). Get (); T = doc.select ("title"); PageTitle = t.text (); } Grip (IOException E) {// TODO Auto-Generated Catch Block e.printStackTrace (); } Return page title; }    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -