This code snippet found here complete my previous snippet that i’ve used to grab a single file on a remote server

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import java.io.IOException;

import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;

import android.app.Activity;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.Toast;
   
public class SimpleWebGrab extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
        grabURL("http://android.com");
    }
   
    public void grabURL(String url) {
        new GrabURL().execute(url);
    }
   
    private class GrabURL extends AsyncTask<string , Void, Void> {
        private final HttpClient Client = new DefaultHttpClient();
        private String Content;
        private String Error = null;
        private ProgressDialog Dialog = new ProgressDialog(SimpleWebGrab.this);
       
        protected void onPreExecute() {
            Dialog.setMessage("Downloading source..");
            Dialog.show();
        }

        protected Void doInBackground(String... urls) {
            try {
                HttpGet httpget = new HttpGet(urls[0]);
                ResponseHandler</string><string> responseHandler = new BasicResponseHandler();
                Content = Client.execute(httpget, responseHandler);
            } catch (ClientProtocolException e) {
                Error = e.getMessage();
                cancel(true);
            } catch (IOException e) {
                Error = e.getMessage();
                cancel(true);
            }
           
            return null;
        }
       
        protected void onPostExecute(Void unused) {
            Dialog.dismiss();
            if (Error != null) {
                Toast.makeText(SimpleWebGrab.this, Error, Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(SimpleWebGrab.this, "Source: " + Content, Toast.LENGTH_LONG).show();
            }
        }
       
    }
}
</string>

Popularity: 1% [?]

Free Tarot

Posted: 7th December 2011 by Giovanni in Android, Mobile World, My Works, Smartphone
Tags: , , , , ,

Avete sempre cercato un’app che semplicemente estraesse dei tarocchi?
Avete sempre cercato di giocare a Sine Requie senza dover necessariamente utilizzare e rovinare i bellissimi tarocchi targati Asterion?
Bene, questa semplicissima app GRATUITA per Android permette di fare essenzialmente una cosa: Estrarre tarocchi, sia i maggiori che i minori! Cosa Aspetti, scarica a valutala!

qr code free tarot android market

Popularity: 2% [?]

How to get our sw version at runtime

1
2
3
4
5
6
Private Function GetVersion() As String
    Dim versione As String = String.Empty
    Dim gi As FileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly.Location)
    versione = gi.FileMajorPart & "." & gi.FileMinorPart & "." & gi.FileBuildPart & "." & gi.FilePrivatePart
    Return versione
End Function

Popularity: 2% [?]

Si è svolto presso il K2 di Putignano (BA) il campionato regionale Pugliese di boulder, qui di seguito un breve sunto fotografico direttamente dalla gara :)

Created with flickr slideshow.

Popularity: 2% [?]

[ITA] Questo snippet permette di poter fare un check se la connessione ad internet è attiva o meno.
[ENG] This code snippet check if internet connection is active or less.

1
2
3
4
5
6
7
8
  NetworkInfo i = conMgr.getActiveNetworkInfo();
  if (i == null)
    return false;
  if (!i.isConnected())
    return false;
  if (!i.isAvailable())
    return false;
  return true;

Popularity: 3% [?]