Grazie LeleFT per la risposta.
Aspettando che qualcuno rispondesse alla discussione e tra una ricerca su Google e un libro sulla programmazione in Android, ho messo in piedi questo codice, ma mi sono fermato.
Nel LogCat gli output sono corretti:
codice:
04-13 11:10:46.443: I/RemoteStringnew(9941): https://www.LinkFromImageonTheGoogle.net/myImage.png
04-13 11:10:46.443: I/RemoteStringnew(9941): 23/03/2014
04-13 11:10:46.443: I/RemoteStringnew(9941): <a href=http://www.mywebpage.net?ID=768>Foto 5</a>
04-13 11:10:46.443: I/RemoteStringnew(9941): https://www.LinkFromImageonTheGoogle.net/myImage1.png
04-13 11:10:46.443: I/RemoteStringnew(9941): 09/03/2014
04-13 11:10:46.443: I/RemoteStringnew(9941): <a href=http://www.mywebpage.net?ID=767>Foto 4</a>
04-13 11:10:46.443: I/RemoteStringnew(9941): https://www.LinkFromImageonTheGoogle.net/myImage2.png
04-13 11:10:46.443: I/RemoteStringnew(9941): 25/02/2014
04-13 11:10:46.443: I/RemoteStringnew(9941): <a href=http://www.mywebpage.net?ID=766>Foto 3</a>
04-13 11:10:46.443: I/RemoteStringnew(9941): https://www.LinkFromImageonTheGoogle.net/myImage3.png
04-13 11:10:46.443: I/RemoteStringnew(9941): 16/02/2014
04-13 11:10:46.443: I/RemoteStringnew(9941): <a href=http://www.mywebpage.net?ID=765>Foto 2</a>
04-13 11:10:46.443: I/RemoteStringnew(9941): https://www.LinkFromImageonTheGoogle.net/myImage4.png
04-13 11:10:46.443: I/RemoteStringnew(9941): 13/02/2014
04-13 11:10:46.443: I/RemoteStringnew(9941): <a href=http://www.mywebpage.net?ID=764>Foto 1</a>
Ma invece di avere in uscita:
codice:
https://www.LinkFromImageonTheGoogle.net/myImage.png ( Non si vede l'img, ma il link all'img)
23/03/2014
Foto 5 (con il link attivo su http://www.mywebpage.net?ID=768)
https://www.LinkFromImageonTheGoogle.net/myImage1.png ( Non si vede l'img, ma il link all'img )
22/03/2014
Foto 4 (con il link attivo su http://www.mywebpage.net?ID=767)
https://www.LinkFromImageonTheGoogle.net/myImage2.png ( Non si vede l'img, ma il link all'img )
21/03/2014
Foto 3 (con il link attivo su http://www.mywebpage.net?ID=766)
https://www.LinkFromImageonTheGoogle.net/myImage2.png ( Non si vede l'img, ma il link all'img )
21/03/2014
Foto 2 (con il link attivo su http://www.mywebpage.net?ID=765)
https://www.LinkFromImageonTheGoogle.net/myImage2.png ( Non si vede l'img, ma il link all'img )
21/03/2014
Foto 1 (con il link attivo su http://www.mywebpage.net?ID=764)
Ho questo output:
codice:
https://www.LinkFromImageonTheGoogle.net/myImage.png
23/03/2014
<a href=http://www.mywebpage.net?ID=768>Foto 5</a>
https://www.LinkFromImageonTheGoogle.net/myImage1.png
09/03/2014
<a href=http://www.mywebpage.net?ID=767>Foto 4</a>
https://www.LinkFromImageonTheGoogle.net/myImage2.png
25/02/2014
<a href=http://www.mywebpage.net?ID=766>Foto 3</a>
https://www.LinkFromImageonTheGoogle.net/myImage3.png
16/02/2014
<a href=http://www.mywebpage.net?ID=765>Foto 2</a>
https://www.LinkFromImageonTheGoogle.net/myImage4.png
13/02/2014
<a href=http://www.mywebpage.net?ID=764>Foto 1</a>
Questa è la classe java, dove sbaglio?:
codice:
public class news extends Activity {
private static final String SOAP_ACTION = "xxxxx.com: The Leading XXX Site on the Net
private static final String OPERATION_NAME = "GetNews";
private static final String WSDL_TARGET_NAMESPACE = "xxxxx.com: The Leading XXX Site on the Net
private static final String SOAP_ADDRESS = "xxxxx.com: The Leading XXX Site on the Net
private ListView mainListView;
private ArrayAdapter<String> listAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mains);
mainListView = (ListView) findViewById(R.id.mainListView);
SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,
OPERATION_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.implicitTypes = false;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
httpTransport.debug = true;
envelope.setOutputSoapObject(request);
try {
httpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
String ws = response.toString();
Log.i("wsString", ws.toString());
String wsnew = ws.replaceAll("<br />", "\n");
Log.i("RemoteStringnew", wsnew);
String[] wss = wsnew.split("\n");
Spanned spanned = Html.fromHtml(wss.toString());
Object[] strings = spanned.getSpans(0, ws.length(), Object.class);
List<String> urls = new ArrayList<String>();
for (Object obj : strings) {
if (obj instanceof URLSpan) {
URLSpan urlSpan = (URLSpan) obj;
urls.add(urlSpan.getURL());
}
}
ArrayList<String> planetList = new ArrayList<String>();
planetList.addAll(Arrays.asList(wss));
listAdapter = new ArrayAdapter<String>(this, R.layout.simplerow,
R.id.rowTextView, planetList);
listAdapter.addAll(urls);
mainListView.setAdapter(listAdapter);
} catch (Exception exception) {
Log.e("Error: ", exception.toString());
}
}
}
mains.xml
codice:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/mainListView">
</ListView>
</LinearLayout>
simplerow.xml
codice:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rowTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="16sp" >
</TextView>