Skyrock.com
  • HOMEPAGE
  • BLOGS
  • PROFILS
  • CHAT
  • Apps
  • Music
  • Sources
  • Videos
  • Gifts
  • Cashback
  • Log in
  • Facebook
  • Google+
  • Create your Blog

  • Blog
  • Profile

Electronica

Pictures of MIRTZ

MIRTZ

Description:

Olá sou o Luis e neste blog vou falar das minhas criações roboticas .Espero que se divirtam pois eu vou divertir-me.

  • Send a message
  • Give a gift
  • Follow
  • Block
  • Choose this background

Awards (9)

  • 10 fans
  • Werewolf
  • Addict
  • Nomad
  • 25 Hearts
  • 25 posts

» More

Profile

MIRTZ's Profile
MIRTZ42 yo
viseu
Portugal

Share

  • Tweet
  • Friends 0

Design by the-skyrock-team Choose this background

Report abuse

Info

  • Created: 30/03/2008 at 6:43 AM
  • Updated: Yesterday at 7:09 AM
  • 44 articles
  • 16 comments
  • 2 friends
  • 2 favourites
  • 29 hearts

Tags

  • android
  • asynctask
  • dx8
  • dx8 cable diy
  • dx8 diy cable
  • dx8 ppjoy
  • dx8 ppm cable
  • dx8 trainer cable
  • Estacão
  • example
  • homemade
  • metal detectors reviews
  • pinpointer
  • ppjoy
  • ppm
  • ppm dx8
  • ppm pic
  • progressbar
  • spectrum dx8 trainer cable
  • thread

» More

My archives (44)

  • Make of TV controller
  • Amazon Dot "Alexa" controlling non Smart TV
  • BB gun Homemade
  • Estação registo de temperatura

» More

Their fans (14)

  • adem0606
  • PULPEUSE
  • theniceguy
  • khalifab13
  • mag60
  • CINE-DIRECT
  • Alecsandra
  • Del-mundo-9445
  • Margaret-jane-Eva-217
  • a-skyrock-team
  • intelligence-passagere
  • Dimitri555
  • Sir-Darren

» More

Sources (2)

  • a-skyrock-team
  • Del-mundo-9445

Skyrock links Advertisement

Subscribe to my blog!

RSS

Return to the blog of MIRTZ

1 tagged article example

Search all tagged articles example

Android AsyncTask process + progressbar example

/*Here you can see an example of asynctask that updates a progress bar and add a coma to some string and post the text on a TextView
*/




package asctask.mig;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;

public class AscTaskActivity extends Activity {
TextView tv1;
String st,st1,st2,st3;
ProgressBar pb1;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
st = "";
TextView tv1 = (TextView) findViewById(R.id.tv1);
atask task = new atask();
String st1 = "um", st2 = "dois", st3 = "Tres";
task.execute(st1, st2, st3);

}

private class atask extends AsyncTask<String, Integer, String> {

// can use UI thread here
protected void onPreExecute(String st) {
st1=st1+"1";
st2=st2+"2";
st3=st3+"3";
Toast.makeText(getApplicationContext(), st1+st2+st3,1).show();
}
protected void onProgressUpdate(Integer... p){
pb1=(ProgressBar)findViewById(R.id.pb1);
pb1.setProgress(p[0]);

}
// automatically done on worker thread (separate from UI thread)
@Override
protected String doInBackground(String... in) {
String fixed = "";
int z;
for (z=1;z<100;z++){
try {
Thread.sleep(100);
publishProgress(z);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


}
for (z = 0; z < in.length; z++) {//Processa dados recebidos
fixed+= in[z]+ ";";
}

return fixed; //retorna dados processados

}

// can use UI thread here
protected void onPostExecute(String st) {
TextView tv1 = (TextView) findViewById(R.id.tv1);
tv1.setText(st);
}
}
}
Tags : Android AsyncTask, android, asynctask, progressbar, thread, example
​ 1 | 0 | Share
Comment

More informationDon't forget that insults, racism, etc. are forbidden by Skyrock's 'General Terms of Use' and that you can be identified by your IP address (54.80.123.20) if someone makes a complaint.

Log in

#Posted on Saturday, 29 October 2011 at 11:02 AM

Skyrock.com
Discover
  • Skyrock

    • Advertisement
    • Jobs
    • Contact
    • Sources
    • Post to my blog
    • Developers
  • Info

    • Here you are free
    • Security
    • Conditions
    • Help
    • Report abuse
    • In figures
  • Apps

    • Skyrock.com
    • Skyrock FM
    • Smax
    • Yax
  • Other sites

    • Skyrock.fm
    • Tito Street
    • Tasanté
    • kwest
    • Zipalo
    • oMIXo
  • Blogs

    • The Skyrock Team
    • Music
    • Ciné
    • Sport
  • Versions

    • International (english)
    • France
    • Site mobile