Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class download_applegaramound {
- public void download_applegaramound() {
- final ProgressDialog dialog = ProgressDialog.show(this, "TitleMessage", true);
- final Handler handler = new Handler() {
- public void handleMessage(Message msg) {
- dialog.dismiss();
- }
- };
- Thread checkUpdate = new Thread() {
- public void run() {
- try {
- byte[] b = new byte[1];
- URL url = new URL("");
- URLConnection urlConnection = url.openConnection();
- urlConnection.connect();
- DataInputStream di = new DataInputStream(urlConnection.getInputStream());
- FileOutputStream fo = new FileOutputStream("/sdcard/");
- while (-1 != di.read(b, 0, 1))
- fo.write(b, 0, 1);
- di.close();
- fo.close();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- handler.sendEmptyMessage(0);
- }
- };
- checkUpdate.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement