ciao, per chiedere una consultazione per un errore che ho nel mio progetto AndroidStudio, non so se posso chidere qui
comunque devo chiamare getLink() che mi fornisce il link dall'xml PullParser e devo chiare questo dentro al metodo DownloadFromUrl
qui il mio codice della main activity
x1public void DownloadFromUrlZip(int pos){
2try {
3
4String s = mAdapter.getItem(pos).getLink();
5URL url = new URL(s);
6HttpURLConnection c = (HttpURLConnection)url.openConnection();
7c.setRequestMethod("GET");
8c.setDoOutput(true);
9c.connect();
10
11String Path = Environment.getExternalStorageDirectory() + "/download/";
12Log.v("AtlantisSites", "PATH: " + Path);
13File file = new File(Path);
14file.mkdirs();
15FileOutputStream fos = new FileOutputStream("fileprova.txt");
16
17InputStream is = c.getInputStream();
18
19byte[] buffer = new byte[1024];
20int len1 = 0;
21while ((len1 = is.read(buffer)) != -1) {
22fos.write(buffer, 0, len1);
23}
24fos.close();
25is.close();
26} catch (IOException e) {
27Log.d("AtlantisSites", "Error: " + e);
28}
29Log.v("AtlantisSites", "Check: ");
30}
mi da un errore per il getLink(pos) ....pos che sta per position
come posso fare?
Nota del moderatore:
Il posto appropriato in cui porre questo genere di quesiti è la discussione in cui è attualmente ubicato il tuo post. In aggiunta, quando posti del codice, è necessario formattarlo attraverso gli appositi TAG, in questo caso adoperando quello Java.