No se pudieron analizar las tags HTML del sitio en vivo en Android

Estamos trabajando en una aplicación de apagado de energía en el dominio de Android para una región en particular. Así que necesitamos los detalles de la actualización en vivo de la URL. Así que necesitamos obtener las tags HTML del sitio en vivo. No obtuvimos nada.

Por ejemplo, en esta aplicación obtenemos un título de la URL en vivo y lo ponemos en una vista de texto. El código viene aquí. Estamos utilizando JSOUP para obtener los valores.

package com.example.poweralert.app; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Documented; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import android.app.ProgressDialog; import android.provider.DocumentsContract; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ListAdapter; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.SimpleAdapter; import android.widget.TextView; import android.widget.Toast; import android.content.Intent; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.RelativeLayout.LayoutParams; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.jsoup.Jsoup; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import org.jsoup.nodes.Document; public class PrimaryActivity extends ActionBarActivity { private RadioGroup radioOptionGroup; private RadioButton radiooptiobtn; private Button btnDisplay; /*public String loadJSONFromAsset() { String json = null; try { InputStream is = getAssets().open("locate.json"); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); json = new String(buffer, "UTF-8"); } catch (IOException ex) { ex.printStackTrace(); return null; } return json; }*/ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_primary); String title=null; Document document; try { document= Jsoup.connect("https://www.facebook.com/") .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get(); title=document.title(); TextView text=(TextView)findViewById(R.id.textView); text.setText(title); } catch (Exception e) { e.printStackTrace(); Log.d("tag","document"); } /*List formList= new ArrayList(); try { JSONObject jSONObject = new JSONObject(loadJSONFromAsset()); JSONArray jsonArray = jSONObject.getJSONArray("Manali"); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jo_inside = jsonArray.getJSONObject(i); if (jo_inside.has("location")) { formList.add(jo_inside.getString("location")); } } ListView listView = (ListView) findViewById(R.id.listView1); listView.setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, formList)); } catch (JSONException e) { e.printStackTrace(); }*/ Button button= (Button) findViewById(R.id.btndis); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); } 

}

cómo mostrar el título del sitio de URL en vivo en la vista de texto. El código anterior no muestra nada.

myHtml

   

También tengo esto en registro de gato cuando se ejecuta la aplicación

 04-03 12:29:11.123 26083-26083/com.example.ipower.app D/dalvikvm﹕ Zygote::ForkAndSpecialize : 0 04-03 12:29:11.124 26083-26083/com.example.ipower.app D/dalvikvm﹕ zygote get new systemTid : 26083 04-03 12:29:11.124 26083-26083/com.example.ipower.app D/dalvikvm﹕ Late-enabling CheckJNI 04-03 12:29:11.127 26083-26083/com.example.ipower.app D/jdwp﹕ prepping for JDWP over ADB 04-03 12:29:11.127 26083-26083/com.example.ipower.app D/jdwp﹕ ADB transport startup 04-03 12:29:11.127 26083-26086/com.example.ipower.app D/dalvikvm﹕ Elevating priority from 0 to -8 04-03 12:29:11.127 26083-26087/com.example.ipower.app D/jdwp﹕ JDWP: thread running 04-03 12:29:11.130 26083-26087/com.example.ipower.app D/jdwp﹕ acceptConnection 04-03 12:29:11.130 26083-26087/com.example.ipower.app D/jdwp﹕ trying to receive file descriptor from ADB 04-03 12:29:11.143 26083-26087/com.example.ipower.app D/jdwp﹕ received file descriptor 40 from ADB 04-03 12:29:11.144 26083-26083/com.example.ipower.app D/dalvikvm﹕ zygote get thread init done 04-03 12:29:11.148 26083-26087/com.example.ipower.app D/jdwp﹕ processIncoming 04-03 12:29:11.148 26083-26087/com.example.ipower.app D/jdwp﹕ processIncoming 04-03 12:29:11.148 26083-26087/com.example.ipower.app D/jdwp﹕ handlePacket : cmd=0x1, cmdSet=0xC7, len=0x13, id=0x40000024, flags=0x0, dataLen=0x8 04-03 12:29:11.162 26083-26087/com.example.ipower.app D/jdwp﹕ processIncoming 04-03 12:29:11.162 26083-26087/com.example.ipower.app D/jdwp﹕ handlePacket : cmd=0x1, cmdSet=0xC7, len=0x17, id=0x40000025, flags=0x0, dataLen=0xC 04-03 12:29:11.170 26083-26087/com.example.ipower.app D/jdwp﹕ processIncoming 04-03 12:29:11.170 26083-26087/com.example.ipower.app D/jdwp﹕ handlePacket : cmd=0x1, cmdSet=0xC7, len=0x13, id=0x40000026, flags=0x0, dataLen=0x8 04-03 12:29:11.176 26083-26087/com.example.ipower.app D/jdwp﹕ processIncoming 04-03 12:29:11.176 26083-26087/com.example.ipower.app D/jdwp﹕ handlePacket : cmd=0x1, cmdSet=0xC7, len=0x13, id=0x40000027, flags=0x0, dataLen=0x8 04-03 12:29:11.715 26083-26083/com.example.ipower.app D/jdwp﹕ sendBufferedRequest : len=0x3D 04-03 12:29:12.295 26083-26083/com.example.ipower.app D/jdwp﹕ sendBufferedRequest : len=0x47 04-03 12:29:12.464 26083-26083/com.example.ipower.app W/asset﹕ AssetManager-->addDefaultAssets CIP path not exsit! 04-03 12:29:13.130 26083-26083/com.example.ipower.app W/System.err﹕ android.os.NetworkOnMainThreadException 04-03 12:29:13.139 26083-26083/com.example.ipower.app W/System.err﹕ at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1128) 04-03 12:29:13.139 26083-26083/com.example.ipower.app W/System.err﹕ at java.net.InetAddress.lookupHostByName(InetAddress.java:385) 04-03 12:29:13.139 26083-26083/com.example.ipower.app W/System.err﹕ at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236) 04-03 12:29:13.139 26083-26083/com.example.ipower.app W/System.err﹕ at java.net.InetAddress.getAllByName(InetAddress.java:214) 04-03 12:29:13.139 26083-26083/com.example.ipower.app W/System.err﹕ at libcore.net.http.HttpConnection.(HttpConnection.java:70) 04-03 12:29:13.139 26083-26083/com.example.ipower.app W/System.err﹕ at libcore.net.http.HttpConnection.(HttpConnection.java:50) 04-03 12:29:13.139 26083-26083/com.example.ipower.app W/System.err﹕ at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:340) 04-03 12:29:13.139 26083-26083/com.example.ipower.app W/System.err﹕ at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87) 04-03 12:29:13.139 26083-26083/com.example.ipower.app W/System.err﹕ at libcore.net.http.HttpConnection.connect(HttpConnection.java:128) 04-03 12:29:13.139 26083-26083/com.example.ipower.app W/System.err﹕ at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:316) 04-03 12:29:13.139 26083-26083/com.example.ipower.app W/System.err﹕ at libcore.net.http.HttpEngine.connect(HttpEngine.java:311) 04-03 12:29:13.139 26083-26083/com.example.ipower.app W/System.err﹕ at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:290) 04-03 12:29:13.140 26083-26083/com.example.ipower.app W/System.err﹕ at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:240) 04-03 12:29:13.140 26083-26083/com.example.ipower.app W/System.err﹕ at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:81) 04-03 12:29:13.140 26083-26083/com.example.ipower.app W/System.err﹕ at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:449) 04-03 12:29:13.140 26083-26083/com.example.ipower.app W/System.err﹕ at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:434) 04-03 12:29:13.140 26083-26083/com.example.ipower.app W/System.err﹕ at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:181) 04-03 12:29:13.140 26083-26083/com.example.ipower.app W/System.err﹕ at org.jsoup.helper.HttpConnection.get(HttpConnection.java:170) 04-03 12:29:13.140 26083-26083/com.example.ipower.app W/System.err﹕ at com.example.ipower.app.MainActivity.onCreate(MainActivity.java:29) 04-03 12:29:13.140 26083-26083/com.example.ipower.app W/System.err﹕ at android.app.Activity.performCreate(Activity.java:5122) 04-03 12:29:13.140 26083-26083/com.example.ipower.app W/System.err﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081) 04-03 12:29:13.140 26083-26083/com.example.ipower.app W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307) 04-03 12:29:13.140 26083-26083/com.example.ipower.app W/System.err﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395) 04-03 12:29:13.141 26083-26083/com.example.ipower.app W/System.err﹕ at android.app.ActivityThread.access$600(ActivityThread.java:162) 04-03 12:29:13.142 26083-26083/com.example.ipower.app W/System.err﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364) 04-03 12:29:13.142 26083-26083/com.example.ipower.app W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:107) 04-03 12:29:13.142 26083-26083/com.example.ipower.app W/System.err﹕ at android.os.Looper.loop(Looper.java:194) 04-03 12:29:13.142 26083-26083/com.example.ipower.app W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5371) 04-03 12:29:13.142 26083-26083/com.example.ipower.app W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method) 04-03 12:29:13.142 26083-26083/com.example.ipower.app W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:525) 04-03 12:29:13.142 26083-26083/com.example.ipower.app W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 04-03 12:29:13.142 26083-26083/com.example.ipower.app W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 04-03 12:29:13.143 26083-26083/com.example.ipower.app W/System.err﹕ at dalvik.system.NativeStart.main(Native Method) 04-03 12:29:13.143 26083-26083/com.example.ipower.app I/System.out﹕ [CDS] fix other exception in HttpUrlConnection 04-03 12:29:13.143 26083-26083/com.example.ipower.app W/System.err﹕ java.io.IOException 04-03 12:29:13.143 26083-26083/com.example.ipower.app W/System.err﹕ at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:87) 04-03 12:29:13.143 26083-26083/com.example.ipower.app W/System.err﹕ at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:449) 04-03 12:29:13.143 26083-26083/com.example.ipower.app W/System.err﹕ at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:434) 04-03 12:29:13.144 26083-26083/com.example.ipower.app W/System.err﹕ at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:181) 04-03 12:29:13.144 26083-26083/com.example.ipower.app W/System.err﹕ at org.jsoup.helper.HttpConnection.get(HttpConnection.java:170) 04-03 12:29:13.144 26083-26083/com.example.ipower.app W/System.err﹕ at com.example.ipower.app.MainActivity.onCreate(MainActivity.java:29) 04-03 12:29:13.144 26083-26083/com.example.ipower.app W/System.err﹕ at android.app.Activity.performCreate(Activity.java:5122) 04-03 12:29:13.144 26083-26083/com.example.ipower.app W/System.err﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081) 04-03 12:29:13.144 26083-26083/com.example.ipower.app W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307) 04-03 12:29:13.144 26083-26083/com.example.ipower.app W/System.err﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395) 04-03 12:29:13.144 26083-26083/com.example.ipower.app W/System.err﹕ at android.app.ActivityThread.access$600(ActivityThread.java:162) 04-03 12:29:13.144 26083-26083/com.example.ipower.app W/System.err﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364) 04-03 12:29:13.144 26083-26083/com.example.ipower.app W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:107) 04-03 12:29:13.144 26083-26083/com.example.ipower.app W/System.err﹕ at android.os.Looper.loop(Looper.java:194) 04-03 12:29:13.144 26083-26083/com.example.ipower.app W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5371) 04-03 12:29:13.144 26083-26083/com.example.ipower.app W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method) 04-03 12:29:13.145 26083-26083/com.example.ipower.app W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:525) 04-03 12:29:13.145 26083-26083/com.example.ipower.app W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 04-03 12:29:13.145 26083-26083/com.example.ipower.app W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 04-03 12:29:13.145 26083-26083/com.example.ipower.app W/System.err﹕ at dalvik.system.NativeStart.main(Native Method) 04-03 12:29:13.171 26083-26083/com.example.ipower.app V/PhoneWindow﹕ DecorView setVisiblity: visibility = 4 04-03 12:29:14.790 26083-26083/com.example.ipower.app V/PhoneWindow﹕ DecorView setVisiblity: visibility = 0 04-03 12:29:14.919 26083-26083/com.example.ipower.app D/libEGL﹕ loaded /system/lib/egl/libEGL_mali.so 04-03 12:29:14.936 26083-26083/com.example.ipower.app D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_mali.so 04-03 12:29:14.941 26083-26083/com.example.ipower.app D/libEGL﹕ loaded /system/lib/egl/libGLESv2_mali.so 04-03 12:29:15.013 26083-26083/com.example.ipower.app D/OpenGLRenderer﹕ Enabling debug mode 0