Process Dialog not showing ( Android / AsyncTask ) - android

Someone please read my code its given below,
the process dialog is not showing up,
seems like a minor mistake :D
Thanks in advance.
public class InternalData extends Activity implements OnClickListener {
EditText sharedData;
TextView dataResults;
FileOutputStream fos;
String FILENAME = "internalString";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sharedprefs);
InitializeVars();
}
public void InitializeVars() {
Button save = (Button) findViewById(R.id.bSave);
Button load = (Button) findViewById(R.id.bLoad);
sharedData = (EditText) findViewById(R.id.etSharedPrefs);
dataResults = (TextView) findViewById(R.id.tvSharedPrefs);
save.setOnClickListener(this);
load.setOnClickListener(this);
try {
fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
#Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.bSave:
String data = sharedData.getText().toString();
/*
* //Saving data via File File f = new File(FILENAME); try { fos =
* new FileOutputStream(f); fos.close(); } catch(IOException e) {
* e.printStackTrace(); }
*/
try {
fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(data.getBytes());
} catch (IOException e) {
e.printStackTrace();
}
break;
case R.id.bLoad:
new loadSomeStuff().execute(FILENAME);
break;
}
}
public class loadSomeStuff extends AsyncTask<String, Integer, String> {
ProgressDialog dialog = new ProgressDialog(InternalData.this);
protected void onPreExecute(String f) {
// dialog = new ProgressDialog(InternalData.this)
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dialog.setMax(100);
dialog.show();
}
#Override
protected String doInBackground(String... params) {
// all this can be done without making this whole AsyncTask class,
// but it will exaust our activity user interface, / slow it down
String collected = null;
FileInputStream fis = null;
for (int i = 0; i < 20; i++) {
publishProgress(5);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
dialog.dismiss();
try {
fis = openFileInput(FILENAME);
byte[] dataArray = new byte[fis.available()];
while (fis.read(dataArray) != -1) {
collected = new String(dataArray);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
fis.close();
return collected;
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
protected void onProgressUpdate(Integer... progress) {
dialog.incrementProgressBy(progress[0]);
}
protected void onPostExecute(String result) {
dataResults.setText(result);
}
}
}

Change your onPreExecute() you're using it wrong, you should this instead
#Override
protected void onPreExecute() {
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dialog.setMax(100);
dialog.show();
}

Related

sockets doesn't work over wan

I am doing a simple chat application between two android devices using sockets (TCP connection) the problem is it works only over LAN but doesn't work over WAN how can i fix this problem ?
ClientSide::
public class MainActivity extends AppCompatActivity {
TextView tv_device, tv_receive, tv_transmit;
Button btn_connect, btn_GPS;
EditText et_IP_Address, et_port, et_message;
Socket S;
DataOutputStream DOS;
DataOutputStream DOS2;
DataInputStream DIS;
Thread TH;
Thread TH2;
String data;
int q=0;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
et_IP_Address= (EditText) findViewById(R.id.et_IP_Address);
et_port= (EditText) findViewById(R.id.et_port);
et_message= (EditText) findViewById(R.id.et_message);
et_message.setText("GPS");
btn_connect = (Button) findViewById(R.id.btn_connect);
btn_GPS= (Button) findViewById(R.id.btn_send);
tv_transmit=(TextView) findViewById(R.id.tv_transmit);
tv_receive = (TextView) findViewById(R.id.tv_receive);
tv_device = (TextView) findViewById(R.id.tv_device);
// connection
btn_connect.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
TH=new Thread(new Runnable() {
#Override
public void run() {
try {
S = new Socket(et_IP_Address.getText().toString(),Integer.parseInt(et_port.getText().toString()));
DOS = new DataOutputStream(S.getOutputStream());
} catch (IOException e) {
e.printStackTrace();
}
}
});// End of thread
TH.start();
}
}); // end of buutton
// Sending
btn_GPS.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
TH2=new Thread(new Runnable() {
#Override
public void run() {
while (!Thread.currentThread().isInterrupted()) {
try {
DOS2 = new DataOutputStream(S.getOutputStream());
DOS2.writeUTF(et_message.getText().toString());
} catch (IOException e) {
e.printStackTrace();
}
tv_transmit.post(new Runnable() {
#Override
public void run() {
tv_transmit.setText(et_message.getText());
}
});
try {
DOS2.flush();
} catch (IOException e) {
e.printStackTrace();
}
try {
DIS = new DataInputStream(S.getInputStream());
} catch (IOException e) {
e.printStackTrace();
}
while (DIS!=null) {
try {
data = DIS.readUTF();
} catch (IOException e) {
e.printStackTrace();
}
data = data.toString();
tv_receive.post(new Runnable() {
public void run() {
tv_receive.setText(data);
}
});
try {
DOS2.close();
DIS.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}); // end of thread
TH2.start();
}
}); // end of button
}
#Override
protected void onStop() {
super.onStop();
try {
if(S != null)
S.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Server Side::
public class MainActivity extends AppCompatActivity {
Thread TH;
String data;
Socket S;
ServerSocket ss;
DataOutputStream DOS;
String recieved="GPS";
String Response;
TextView et_port; TextView tv_receive; TextView tv_transmit; TextView status;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
et_port = (TextView) findViewById(R.id.et_port);
tv_receive = (TextView) findViewById(R.id.tv_receive);
tv_transmit = (TextView) findViewById(R.id.tv_transmit);
status = (TextView) findViewById(R.id.status);
Intent intent = new Intent(this, MyService.class);
startService(intent);
establishconnection();
}
public void establishconnection() {
TH = new Thread(new Runnable() {
#Override
public void run() {
status.setText(MyService.getIpAddress());
try {
ss = new ServerSocket(8080);
} catch (IOException e) {
e.printStackTrace();
}
while (true) {
try {
S = ss.accept();
} catch (IOException e) {
e.printStackTrace();
}
status.post(new Runnable() {
#Override
public void run() {
status.setText("connected");
}
}
);
CommunicationThread commThread = null;
try {
commThread = new CommunicationThread(S);
} catch (IOException e) {
e.printStackTrace();
}
new Thread(commThread).start();
}
}
});
TH.start();
}
class CommunicationThread implements Runnable {
private Socket ClientSocket;
DataInputStream DIS;
public CommunicationThread(Socket ClientSocket) throws IOException {
this.ClientSocket = ClientSocket;
DIS = new DataInputStream(ClientSocket.getInputStream());
data = DIS.readUTF();
}
public void run() {
while (!Thread.currentThread().isInterrupted()) {
data = data.toString();
tv_receive.post(new Runnable() {
public void run() {
tv_receive.setText(data);
}
});
while (recieved.equals(data)) {
sendMessage();
try {
DOS = new DataOutputStream(S.getOutputStream());
} catch (IOException e) {
e.printStackTrace();
}
try {
Thread.sleep(8000);
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
if (Response !=null){
DOS.writeUTF(Response);
}
} catch (IOException e) {
e.printStackTrace();
}
tv_transmit.post(new Runnable() {
#Override
public void run() {
tv_transmit.setText(Response);
}
});
try {
DOS.flush();
DOS.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
S.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
public void sendMessage() {
Intent i = new Intent(this,Gps.class);
startActivityForResult(i, 1);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1) {
if(resultCode == RESULT_OK) {
// Bundle bundle = getIntent().getExtras();
if (data!=null) {
String x = data.getStringExtra("Latitude");
String y = data.getStringExtra("Longitude");
Response = x + "\n" + y;
}
}
}
}
}
Here the client suppose to send a word to server when the server recieves it it will open another intent and return back some data "GPS" to client

Android Dropbox api file exists

I'm downloading a file from Dropbox successfully, but now I want to check if the file in Dropbox does not exist.
It seems that the FileNotFoundException does not work, so I added a boolean to check this, but without success.
Do you have any advice?
protected class DownloadDB extends AsyncTask<Context, Integer, String> {
ProgressDialog myLoadingDialog;
boolean exists = true;
#Override
protected void onPreExecute() {
myLoadingDialog = new ProgressDialog(Impostazioni_pro.this);
myLoadingDialog.setMessage(getString(R.string.sinc));
myLoadingDialog.setIndeterminate(false);
myLoadingDialog.setCancelable(false);
myLoadingDialog.show();
super.onPreExecute();
}
#Override
protected String doInBackground(Context... arg0) {
try {
File OutFolder = new File(Environment.getExternalStorageDirectory(), getString(R.string.app_name) + "/sync/psw.crypt");
OutputStream out = new FileOutputStream(OutFolder);
mApi.getFile("/myfile.db", null, out, null);
} catch (FileNotFoundException e) {
exists = false;
e.printStackTrace();
} catch (DropboxException e) {
e.printStackTrace();
}
return null;
}
#Override
protected void onPostExecute(String result) {
myLoadingDialog.dismiss();
if(exists){
importaDB();
}
super.onPostExecute(result);
}
}
Try catching just the generic Exception:
try {
File OutFolder = new File(Environment.getExternalStorageDirectory(), getString(R.string.app_name) + "/sync/psw.crypt");
OutputStream out = new FileOutputStream(OutFolder);
mApi.getFile("/myfile.db", null, out, null);
} catch (Exception e) {
exists = false;
e.printStackTrace();
}
I use DbxException message:
try{
OutputStream outputStream = new FileOutputStream(dbPath);
client.files.downloadBuilder("/"+backupFileName).run(outputStream);
} catch (DbxException e) {
if (e.getMessage().contains("not_found")) exists= false;
}

EditText to ListView Through SD Card reading

So I need help, I don't know what's I get no errors nothing. Just isn't working
So I got a EditText (TextInput) You write something there for example "potato", when you press the Button (save and addButton) should take whats in the TextInput and put it into the SD card and then the ListView (TextOutput) Should read from that folder and display what it says. Hope you guys understand
The Code I'm using (Updated)
public File file = new File(Environment.getExternalStorageDirectory() + "/accelerometer.html");
public void onCreate1(Bundle savedInstanceState) {
ListView lv = (ListView)findViewById(R.id.textOutput);
final ArrayAdapter<String> arrAdap = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1);
lv.setAdapter(arrAdap);
findViewById(R.id.save).setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
save();
try {
arrAdap.addAll(load());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
arrAdap.notifyDataSetChanged();
}
});
}
public void save() {
String textInput = mTextInput.getText().toString().trim();
if(textInput.equals("")) {
return;
}
}
#SuppressWarnings("unchecked")
public ArrayList<String> load() throws IOException{
FileInputStream fis = null;
ObjectInputStream ois = null;
ArrayList<String> returnlist = null;
try {
fis = new FileInputStream(file);
ois = new ObjectInputStream(fis);
returnlist = (ArrayList<String>) ois.readObject();
} catch (Exception e) {
e.printStackTrace();
} finally {
if(fis != null)
fis.close();
if(ois != null)
ois.close();
}
return returnlist;
}
#Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
}
}
Thanks for all the help in advance :)
add bufferWritter.flush(); after bufferWritter.write(TextImput);
EDIT:
try this code:
private File file = new File(Environment.getExternalStorageDirectory() + "/accelerometer.html");
#Override
public void onCreate(Bundle savedInstanceState) {
ListView lv = (ListView)findViewById(R.id.textOutput);
final ArrayAdapter<String> arrAdap = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1);
lv.setAdapter(arrAdap);
findViewById(R.id.save).setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
save();
arrAdap.add(load());
arrAdap.notifyDataSetChanged();
}
});
}
public void save() {
String textInput = mTextInput.getText().toString().trim();
if(textInput.equals("")
return;
AddButton.setOnClickListener(new OnClickListener() { //i don't know what this should do
#Override //you set the same text to the same textview
public void onClick(View arg0) { //-> does nothing
mTextInput.setText(mTextInput.getText());
}
});
ArrayList<String> input = new ArrayList<>();
input.add(textInput);
FileOutputStream fos;
ObjectOutputStream oos;
try {
fos = new FileOutputStream(file);
oos = new ObjectOutputStream(fos);
oos.writeObject(input);
oos.flush();
} catch (IOException ex) {
ex.printStackTrace();
} finally {
if(fos != null)
fos.close();
if(oos != null)
oos.close();
}
}
public ArrayAdapter<String> load(){
FileInputStream fis;
ObjectInputStream ois;
ArrayList<String> returnlist;
try {
fis = new FileInputStream(file);
ois = new ObjectInputStream(fis);
returnlist = (ArrayList<String>) ois.readObject();
} catch (Exception e) {
e.printStackTrace();
} finally {
if(fis != null)
fis.close();
if(ois != null)
ois.close();
}
return returnlist;
}
it just coded out of my mind. nothing is tested.
maybe you have to handle some IOExceptions in the finally statement but just put another try{...}catch(){...} around it.
I have also added a comment.

saving data to interal memory with async task (newboston tutorials sample) error it has progress bar

this is my first post here
i'm new, so be good with me!
i'm following travis's tutorials and it goes to saving data and using async task
i really focused but i can't find out whats wrong with my code, so i posted here! :
I added the logcat!
it worked without async and progress bar (both save and load)
latest changes!:
i fixed the progress bar but loadwithasync class is not working, i mean this line:
I think this must return the Srting ld and set that in text view res. but it is not looking this way! why travis from mybringback! didn't wrote the line like Strig s = new loadWith..... ? can u tell me where is the problem! i'm confused and i don't know how to debug properly!!
new loadWithAsyncTask().execute(FILENAME);
public class SaveAndLoadInternal extends Activity implements OnClickListener {
EditText file, data;
TextView res;
FileInputStream fis;
FileOutputStream fos;
String FILE_NAME;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.save_load_internal);
Button load, save;
file = (EditText) findViewById(R.id.etSLIfile);
data = (EditText) findViewById(R.id.etSLIdata);
res = (TextView) findViewById(R.id.tvSLIres);
load = (Button) findViewById(R.id.bSLIload);
save = (Button) findViewById(R.id.bSLIsave);
// set file and close it!
load.setOnClickListener(this);
save.setOnClickListener(this);
}
#Override
public void onClick(View v) {
FILE_NAME = file.getText().toString();
switch (v.getId()) {
case R.id.bSLIload:
//Commented just for doing some tweaks! run
//loading process in another thread to give UI thread rest :D for avoid hanging!
FileInputStream fis = null;
String ld = "LOADING FAILED!";
/* try {
fis = openFileInput(FILE_NAME);
byte[] b = new byte[fis.available()];
while (fis.read(b) != -1) {
ld = new String(b);
}
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
res.setText(ld);
*/
new loadWithAsyncTask ().execute(FILE_NAME);
// execute will run doInBackground method!
break;
case R.id.bSLIsave:
String sd = data.getText().toString();
/*
// one way to save in file is below! must work but it isn't!
File f = new File(FILE_NAME);
try {
fos = new FileOutputStream(FILE_NAME);
fos.write(sd.getBytes());
fos.close();
res.setText("SAVING DONE!");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
*/
try {
fos = openFileOutput(FILE_NAME, Context.MODE_PRIVATE);
fos.write(sd.getBytes());
fos.close();
res.setText("SAVING DONE!");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
break;
default:
break;
}
}
// /*
// first param: what is being passed in (FILE_NAME)
// second param for progress bar (we use integer here)
// third one is what we will return! (the saved text! String ld)
public class loadWithAsyncTask extends AsyncTask<String, Integer, String>{
ProgressDialog pd;
String Ld = "LOADING FAILED!";
FileInputStream fis = null;
// this gonna called first
#Override
protected void onPreExecute(){
// example: setting up variables or something else!
pd = new ProgressDialog(SaveAndLoadInternal.this);
pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
pd.setMax(100);
pd.show();
}
#Override
protected String doInBackground(String... params) {
//for progress dialog
for(int i =0 ; i< 20 ; i++){
publishProgress(5);
try {
Thread.sleep(88);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
pd.dismiss();
try {
fis = openFileInput(FILE_NAME);
byte[] b = new byte[fis.available()];
res.setText(String.valueOf(fis.available()));
while (fis.read(b) != -1) {
Ld = new String(b);
}
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
fis.close();
//return the string!
return Ld;
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
// progress of loading in example!
#Override
protected void onProgressUpdate(Integer...progress){
pd.incrementProgressBy(progress[0]);
}
}// */
}
When you look at the error, you'll see that onProgressUpdate() throws a NPE. Looking at the code, there are two possibilities: 1. pd is null or 2. progress is null. Add a breakpoint or some logging there to see what exactly is going on.
protected void onProgressUpdate(Integer...progress){
pd.incrementProgressBy(progress[0]);
}

How to create asyncTask to prevent networkOnMainThreadException

I'm new to android application development. I tried to develop an android server client chat
for my first project. This is the code for the client side. When the client press btnJoin,
it will connect to the server and send a string. I've read many example and many of them
looks like this. I got a networkOnMainThreadException. How do I make an asyncTask to prevent
this problem? Any help would be much appreciated.
btnJoin = (Button) findViewById(R.id.buttonJoin);
btnJoin.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
Socket socket = null;
DataOutputStream dataOutputStream = null;
DataInputStream dataInputStream = null;
try {
socket = new Socket("192.168.1.4", 9092);
dataOutputStream = new DataOutputStream(socket.getOutputStream());
dataInputStream = new DataInputStream(socket.getInputStream());
dataOutputStream.writeUTF("Hello server!");
txtIP.append(dataInputStream.readUTF() + "\n");
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (dataOutputStream != null) {
try {
dataOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (dataInputStream != null) {
try {
dataInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
});
Change your code as:
btnJoin.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View view){
new LongOperation().execute("");
}
}
private class LongOperation extends AsyncTask<String, Void, String> {
Socket socket = null;
String strresult="";
DataOutputStream dataOutputStream = null;
DataInputStream dataInputStream = null;
#Override
protected String doInBackground(String... params) {
try {
socket = new Socket("192.168.1.4", 9092);
dataOutputStream = new DataOutputStream(socket.getOutputStream());
dataInputStream = new DataInputStream(socket.getInputStream());
dataOutputStream.writeUTF("Hello server!");
strresult.append(dataInputStream.readUTF() + "\n");
// txtIP.append(dataInputStream.readUTF() + "\n");
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (dataOutputStream != null) {
try {
dataOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (dataInputStream != null) {
try {
dataInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return strresult;
}
#Override
protected void onPostExecute(String result) {
TextView txtIP= (TextView) findViewById(R.id.txtIP);
// txtIP.append(result + "\n");
txtIP.setText(result + "\n");
}
#Override
protected void onPreExecute() {
}
}
Use AsyncTask like this :
First have it nested in your class, it should look similar to :
private class Communicator extends AsyncTask<Void, Void, Boolean> {
String tmp;
String err;
#Override
protected Boolean doInBackground() {
try {
socket = new Socket("192.168.1.4", 9092);
dataOutputStream = new DataOutputStream(socket.getOutputStream());
dataInputStream = new DataInputStream(socket.getInputStream());
dataOutputStream.writeUTF("Hello server!");
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (dataOutputStream != null) {
try {
dataOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (dataInputStream != null) {
try {
dataInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return true;
}
#Override
protected void onPreExecute() {
}
#Override
protected void onPostExecute(Boolean result) {
txtIP.append(dataInputStream.readUTF() + "\n");
}
}
When you have AsyncTask,you can start it like this :
...
#Override
public void onClick(View v) {
Communicator c=new Communicator();
c.execute();
}
....
try to implement this code in your app
private class LongOperation extends AsyncTask<Object, Integer, Object> {
#Override
protected void onPreExecute() {
super.onPreExecute();
}
#Override
protected Object doInBackground(Object... params) {
//do hard work here
return params;
}
#Override
protected void onProgressUpdate(Integer... values) {
}
#Override
protected void onPostExecute(Object result) {
super.onPostExecute(result);
}
}
AsyncTask must be subclassed to be used. The subclass will override at least one method (doInBackground(Params...)), and most often will override a second one (onPostExecute(Result).)
Here is an example of subclassing:
private class DownloadFilesTask extends AsyncTask<URL, Integer, Long> {
protected Long doInBackground(URL... urls) {
int count = urls.length;
long totalSize = 0;
for (int i = 0; i < count; i++) {
totalSize += Downloader.downloadFile(urls[i]);
publishProgress((int) ((i / (float) count) * 100));
// Escape early if cancel() is called
if (isCancelled()) break;
}
return totalSize;
}
protected void onProgressUpdate(Integer... progress) {
setProgressPercent(progress[0]);
}
protected void onPostExecute(Long result) {
showDialog("Downloaded " + result + " bytes");
}
}
Once created, a task is executed very simply:
new DownloadFilesTask().execute(url1, url2, url3);
for more details refer below links...
http://www.vogella.com/articles/AndroidPerformance/article.html
http://developer.android.com/reference/android/os/AsyncTask.html

Categories

Resources