java - Extracting text from web pages only gives the URL -


please have @ following code

if (intent.action_send.equals(getintent().getaction()))              {                 string text = getintent().getstringextra(intent.extra_text);                  try                 {                     document doc = jsoup.connect(text).get();                     log.i("doc", doc.tostring().tostring());                     elements elementshtml = doc.getelementsbytag("tr");                       arraylist<string> temp1 = new arraylist<string>();                          for(element element: elementshtml)                     {                          temp1.add( element.text());                      }                      //add text edit text                     for(int i=0;i<temp1.size();i++)                     {                         textfield.append(temp1.get(i));                     }                  }                 catch(exception e)                 {                     e.printstacktrace();                 }               } 

this code uses jsoup library android code. need extract text webpage, , purpose of above code. instead, getting url of webpage , appending text field , that's it.

and need text. code targeting "tr".

why happening? how can correct it? please help.

update

i changed code below, , not anything!

 //get web page text if called share-via             if (intent.action_send.equals(getintent().getaction()))              {                 string text = getintent().getstringextra(intent.extra_stream);                  try                 {                     document doc = jsoup.connect(text).get();                     log.i("doc", doc.tostring().tostring());                     elements elementshtml = doc.getelementsbytag("tr");                       arraylist<string> temp1 = new arraylist<string>();                          for(element element: elementshtml)                     {                          temp1.add( element.text());                      }                      //add text edit text                     for(int i=0;i<temp1.size();i++)                     {                         textfield.append(temp1.get(i));                     }                  }                 catch(exception e)                 {                     e.printstacktrace();                 }               } 

this manifest file code (only required part) if helps

<activity             android:name="com.xxx.xxx.xxx"             android:screenorientation="portrait"             android:label="@string/app_name" >              <intent-filter>                 <action android:name="android.intent.action.send" />                 <category android:name="android.intent.category.default" />                 <data android:mimetype="text/plain"/>                 <data android:mimetype="image/*"/>                 <data android:mimetype="video/*"/>             </intent-filter>          </activity> 


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -