List of usage examples for android.app ProgressDialog ProgressDialog
public ProgressDialog(Context context)
From source file:com.example.android.MainActivity.java
/**Display JSON data in table format on the user interface of android app * by clicking on the button 'Start'*/ @Override/* ww w . ja va2 s . c om*/ protected void onCreate(Bundle savedInstanceState) { /** * Declares TextView, Button and Tablelayout to retrieve the widgets * from User Interface. Insert the TableRow into Table and set the * gravity, font size and id of table rows and columns. * * Due to great amount of JSON data, 'for' loop method is used to insert * the new rows and columns in the table. In each loop, each of rows and * columns are set to has its own unique id. This purpose of doing this * is to allows the user to read and write the text of specific rows and * columns easily. */ super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); progress = new ProgressDialog(this); StartDisplay = (Button) findViewById(R.id.btnDisplay); profile = (TableLayout) findViewById(R.id.tableLayout1); profile.setStretchAllColumns(true); profile.bringToFront(); for (int i = 1; i < 11; i++) { TableRow tr = new TableRow(this); TextView c1 = new TextView(this); TextView c2 = new TextView(this); c1.setId(i * 10 + 1); c1.setTextSize(12); c1.setGravity(Gravity.CENTER); c2.setId(i * 10 + 2); c2.setTextSize(12); c2.setGravity(Gravity.CENTER); tr.addView(c1); tr.addView(c2); tr.setGravity(Gravity.CENTER_HORIZONTAL); profile.addView(tr); } /** * onClick: Executes the DownloadWebPageTask once OnClick event occurs. * When user click on the "Start" button, * 1)the JSON data will be read from URL * 2)Progress bar will be shown till all data is read and displayed in * table form. Once it reaches 100%, it will be dismissed. * * Progress Bar: The message of the progress bar is obtained from strings.xml. * New thread is created to handle the action of the progress bar. */ StartDisplay.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { final String TAG = "MyActivity"; progress.setMessage(getResources().getString(R.string.ProgressBar_message)); progress.setCancelable(true); progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progress.setProgress(0); progress.setMax(100); progress.show(); new Thread(new Runnable() { public void run() { while (ProgressBarStatus < 100) { try { Thread.sleep(500); } catch (InterruptedException e) { Log.e(TAG, Log.getStackTraceString(e)); } progressBarbHandler.post(new Runnable() { public void run() { progress.setProgress(ProgressBarStatus); } }); } if (ProgressBarStatus >= 100) { try { Thread.sleep(1000); } catch (InterruptedException e) { Log.e(TAG, Log.getStackTraceString(e)); } progress.dismiss(); } } }).start(); DownloadWebPageTask task = new DownloadWebPageTask(); task.execute("http://private-ae335-pgserverapi.apiary.io/user/profile/234"); StartDisplay.setClickable(false); } }); }
From source file:in.codehex.facilis.LoginActivity.java
/** * Initialize the objects.// ww w .ja v a2 s.c o m */ private void initObjects() { editEmail = (EditText) findViewById(R.id.edit_email); editPass = (EditText) findViewById(R.id.edit_pass); textForgotPass = (TextView) findViewById(R.id.text_forgot_pass); btnLogin = (Button) findViewById(R.id.btn_login); userPreferences = getSharedPreferences(Config.PREF_USER, MODE_PRIVATE); mProgressDialog = new ProgressDialog(this); mWifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE); mWifiInfo = mWifiManager.getConnectionInfo(); }
From source file:cl.mmoscoso.geocomm.sync.GeoCommDeletePointAsyncTask.java
public GeoCommDeletePointAsyncTask(Context context, String hn, int id_point) { this.context = context; this.hostname = hn; this.id_point = id_point; this.mProgressDialog = new ProgressDialog(context); this.mProgressDialog.setMessage(this.context.getResources().getString(R.string.Loading)); this.mProgressDialog.setIndeterminate(false); this.mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); this.mProgressDialog.setCancelable(true); }
From source file:edu.usf.cutr.opentripplanner.android.tasks.ServerChecker.java
/** * Constructs a new ServerChecker/*from w w w . j a va 2 s .c o m*/ * @param */ public ServerChecker(WeakReference<Activity> activity, Context context, ServerCheckerCompleteListener callback, boolean showMessage) { this.activity = activity; this.context = context; this.showMessage = showMessage; this.callback = callback; if (activity.get() != null) { progressDialog = new ProgressDialog(activity.get()); } }
From source file:eu.codeplumbers.cosi.api.tasks.GetPlacesTask.java
public GetPlacesTask(PlacesFragment placesFragment) { this.placesFragment = placesFragment; allPlaces = new ArrayList<>(); Device device = Device.registeredDevice(); // delete all local places new Delete().from(Place.class).execute(); // cozy register device url this.url = device.getUrl() + "/ds-api/request/place/all/"; // concatenate username and password with colon for authentication final String credentials = device.getLogin() + ":" + device.getPassword(); authHeader = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP); dialog = new ProgressDialog(placesFragment.getActivity()); dialog.setCancelable(false);/*from w w w .ja v a2s . c om*/ dialog.setMessage("Please wait"); dialog.setIndeterminate(true); dialog.show(); }
From source file:com.escapeir.server.Connect.java
public Connect(Context context, Activity activity) { this.context = context; this.activity = activity; dialog = new ProgressDialog(activity); }
From source file:com.nextgis.firereporter.ScanexHttpLogin.java
public ScanexHttpLogin(Context c, int nType, String sMsg, Handler eventReceiver, boolean bShowProgress) { super();//w ww. j a va 2 s .c o m mbShowProgress = bShowProgress; mContext = c; if (mbShowProgress) { mDownloadDialog = new ProgressDialog(mContext); } mnType = nType; mEventReceiver = eventReceiver; mDownloadDialogMsg = sMsg; }
From source file:cl.mmoscoso.geocomm.sync.GeoCommCreateRouteAsyncTask.java
public GeoCommCreateRouteAsyncTask(Context context, String hn, String name, String desc, boolean is_public, int id) { this.context = context; this.hostname = hn; this.desc = desc; this.name = name; this.is_public = is_public; this.id_user = id; this.mProgressDialog = new ProgressDialog(context); this.mProgressDialog.setMessage(this.context.getResources().getString(R.string.Loading)); this.mProgressDialog.setIndeterminate(false); this.mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); this.mProgressDialog.setCancelable(true); }
From source file:at.bitfire.davdroid.ui.CreateCollectionFragment.java
@NonNull @Override//w w w . j a va2s .c om public Dialog onCreateDialog(Bundle savedInstanceState) { ProgressDialog progress = new ProgressDialog(getContext()); progress.setTitle(R.string.create_collection_creating); progress.setMessage(getString(R.string.please_wait)); progress.setIndeterminate(true); progress.setCanceledOnTouchOutside(false); setCancelable(false); return progress; }
From source file:cl.mmoscoso.geocomm.sync.GeoCommLogInAsyncTask.java
public GeoCommLogInAsyncTask(Context context, String hn, String name, String pass, GeoCommUser user) { this.context = context; this.hostname = hn; this.pass = pass; this.name = name; this.user = user; this.mProgressDialog = new ProgressDialog(context); this.mProgressDialog.setMessage(this.context.getResources().getString(R.string.Loading)); this.mProgressDialog.setIndeterminate(false); this.mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); this.mProgressDialog.setCancelable(true); }