Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. public class SubjectTask extends AsyncTask<Void, Void, Integer> {
  2.  
  3. @Override
  4. protected void onPreExecute() {
  5. progressDialog = ProgressDialog.show(Login.this, "Loading",
  6. "Please wait...");
  7. //checkConnection();
  8.  
  9. }
  10.  
  11. @Override
  12. protected Integer doInBackground(Void... arg0) {
  13.  
  14. if (isOnline()) { //using ConnectivityManager And Network Info
  15.  
  16. try {
  17.  
  18. //Http Request connections
  19.  
  20. } catch (Exception e) {
  21. e.printStackTrace();
  22. }
  23.  
  24.  
  25.  
  26. return 1;
  27. } else {
  28.  
  29. alert("Check your internet connection");
  30. return 0;
  31. }
  32.  
  33. }
  34.  
  35. protected void onPostExecute(Integer result) {
  36. super.onPostExecute(result);
  37. if (progressDialog.isShowing()) {
  38. progressDialog.dismiss();
  39. }
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement