List of usage examples for android.app ProgressDialog show
public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable)
From source file:com.commonsware.android.EMusicDownloader.SingleBook.java
private void getInfoFromXML() { final ProgressDialog dialog = ProgressDialog.show(this, "", getString(R.string.loading), true, true); setProgressBarIndeterminateVisibility(true); Thread t3 = new Thread() { public void run() { waiting(200);// www . j a v a 2s .c om try { URL url = new URL(urlAddress); SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); XMLHandlerSingleBook myXMLHandler = new XMLHandlerSingleBook(); xr.setContentHandler(myXMLHandler); xr.parse(new InputSource(url.openStream())); genre = myXMLHandler.genre; publisher = myXMLHandler.publisher; narrator = myXMLHandler.narrator; edition = myXMLHandler.edition; artist = myXMLHandler.author; authorId = myXMLHandler.authorId; if (edition == null) { edition = ""; } date = myXMLHandler.releaseDate; rating = myXMLHandler.rating; sampleURL = myXMLHandler.sampleURL; imageURL = myXMLHandler.imageURL; statuscode = myXMLHandler.statuscode; if (statuscode != 200 && statuscode != 206) { throw new Exception(); } blurb = myXMLHandler.blurb; blurb = blurb.replace("<br> ", "<br>"); blurbSource = myXMLHandler.blurbSource; handlerSetContent.sendEmptyMessage(0); dialog.dismiss(); updateImage(); } catch (Exception e) { final Exception ef = e; nameTextView.post(new Runnable() { public void run() { nameTextView.setText(R.string.couldnt_get_book_info); } }); dialog.dismiss(); } handlerDoneLoading.sendEmptyMessage(0); } }; t3.start(); }
From source file:com.lge.friendsCamera.RecordVideoActivity.java
/** * stop recording video// w ww. j a v a 2s .c om */ private void stopVideo() { //Stop Recording mProgressDialog = ProgressDialog.show(mContext, "", "Waiting..", true, false); changeRecordingStatus(STOP); }
From source file:ansteph.com.beecab.view.profile.DriverProfileView.java
private void getProfileData() { final ProgressDialog loading = ProgressDialog.show(this, "Please wait ", "Fetching data...", false, false); String url = String.format(Config.RETRIEVE_DRIVER_PROFILE_URL, taxiID); StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() { @Override/*from www .j av a 2 s . co m*/ public void onResponse(String response) { loading.dismiss(); JSONObject jsonResponse = null; try { jsonResponse = new JSONObject(response); boolean error = jsonResponse.getBoolean(Config.ERROR_RESPONSE); String serverMsg = jsonResponse.getString(Config.MSG_RESPONSE); if (!error) { //get the user detail from the server (String carModel, String carNumberPlate, String currentCity, String profileRating, // String name, String email, String mobile) { JSONArray profile = jsonResponse.getJSONArray("profile"); JSONObject user = profile.getJSONObject(0); //getString(Config.KEY_ID) // String carModel, String carNumberPlate, String currentCity, String profileRating driverProfile = new DriverProfile(user.getString(Config.KEY_CAR_MODEL), user.getString(Config.KEY_CAR_NUMPLATE), user.getString(Config.KEY_CURRENT_CITY), user.getString(Config.KEY_PRO_RATING), user.getString(Config.KEY_DRIVER_NAME), user.getString(Config.KEY_DRIVER_EMAIL), user.getString(Config.KEY_DRIVER_MOBILE) ); driverProfile.setYearoflicense(user.getString(Config.KEY_DRIVER_YEAR)); driverProfile.setLicense(user.getString(Config.KEY_DRIVER_LICENSE)); } } catch (JSONException e) { e.printStackTrace(); } finally { updateUI(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { loading.dismiss(); Toast.makeText(getApplicationContext(), "Oops! Profile unreachable! Please check your internet connection", Toast.LENGTH_LONG) .show(); } }) { }; //Creating a request queue RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext()); //Adding our request to the queue requestQueue.add(stringRequest); }
From source file:org.umit.icm.mobile.gui.ControlActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.controlactivity); WebsiteSuggestButton = (Button) this.findViewById(R.id.suggestWebsite); ServiceSuggestButton = (Button) this.findViewById(R.id.suggestService); scanButton = (Button) this.findViewById(R.id.scanButton); // filterButton = (Button) this.findViewById(R.id.filterButton); // servicesFilterButton = (Button) this.findViewById(R.id.serviceFilterButton); mapSelectionButton = (Button) this.findViewById(R.id.mapSelectionButton); enableTwitterButton = (Button) this.findViewById(R.id.enableTwitterButton); bugReportButton = (Button) this.findViewById(R.id.bugReportButton); aboutButton = (Button) this.findViewById(R.id.aboutButton); scanButton.setText(getString(R.string.scan_text) + " " + getString(R.string.scan_off)); try {/*from w w w .j av a2 s .c o m*/ if (Globals.runtimeParameters.getTwitter().equals("Off")) { enableTwitterButton.setText(getString(R.string.enable_twitter_button)); } else { enableTwitterButton.setText(getString(R.string.disable_twitter_button)); } } catch (RuntimeException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals("org.umit.icm.mobile.CONTROL_ACTIVITY")) { scanButton.setText(getString(R.string.scan_text) + " " + getString(R.string.scan_on)); } } }; registerReceiver(receiver, new IntentFilter("org.umit.icm.mobile.CONTROL_ACTIVITY")); WebsiteSuggestButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { WebsiteSuggestionDialog websiteSuggestionDialog = new WebsiteSuggestionDialog(ControlActivity.this, "", new OnReadyListener()); websiteSuggestionDialog.show(); } }); ServiceSuggestButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { ServiceSuggestionDialog suggestionDialog = new ServiceSuggestionDialog(ControlActivity.this, "", new OnReadyListener()); suggestionDialog.show(); } }); enableTwitterButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { try { if (Globals.runtimeParameters.getTwitter().equals("Off")) { progressDialog = ProgressDialog.show(ControlActivity.this, getString(R.string.loading), getString(R.string.retrieving_website), true, false); new LaunchBrowser().execute(); TwitterDialog twitterDialog = new TwitterDialog(ControlActivity.this, ""); twitterDialog.show(); enableTwitterButton.setText(getString(R.string.disable_twitter_button)); } else { Globals.runtimeParameters.setTwitter("Off"); enableTwitterButton.setText(getString(R.string.enable_twitter_button)); } } catch (RuntimeException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); mapSelectionButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { MapSelectionDialog MapSelectionDialog = new MapSelectionDialog(ControlActivity.this, ""); MapSelectionDialog.show(); } }); /* filterButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(ControlActivity.this, WebsiteFilterActivity.class); startActivity(intent); } } ); servicesFilterButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(ControlActivity.this, ServiceFilterActivity.class); startActivity(intent); } } );*/ bugReportButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(ControlActivity.this, BugReportActivity.class); startActivity(intent); } }); aboutButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { String msg = getString(R.string.about_text) + "\n" + getString(R.string.link_to_open_monitor) + "\n" + getString(R.string.link_to_umit) + "\n" + getString(R.string.icons_by); final SpannableString spannableString = new SpannableString(msg); Linkify.addLinks(spannableString, Linkify.ALL); AlertDialog alertDialog = new AlertDialog.Builder(ControlActivity.this).create(); alertDialog.setTitle(getString(R.string.about_button)); alertDialog.setMessage(spannableString); alertDialog.setIcon(R.drawable.umit_128); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialog.show(); } }); scanButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (Globals.scanStatus.equalsIgnoreCase(getString(R.string.scan_on))) { scanButton.setText(getString(R.string.scan_text) + " " + getString(R.string.scan_on)); Globals.scanStatus = getString(R.string.scan_off); stopService(new Intent(ControlActivity.this, ConnectivityService.class)); } else { scanButton.setText(getString(R.string.scan_text) + " " + getString(R.string.scan_off)); Globals.scanStatus = getString(R.string.scan_on); startService(new Intent(ControlActivity.this, ConnectivityService.class)); } try { Globals.runtimeParameters.setScanStatus(Globals.scanStatus); } catch (RuntimeException e) { e.printStackTrace(); } Context context = getApplicationContext(); CharSequence text = getString(R.string.toast_scan_change) + " " + Globals.scanStatus; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } }); }
From source file:foo.fruitfox.evend.LoginActivity.java
public void verify(View view) { String identifier = StorageHelper.PreferencesHelper.getIdentifier(this); verificationCode = (EditText) findViewById(R.id.verificationCodeText); userData = StorageHelper.PreferencesHelper.getUserData(this, identifier); if (verificationCode.getText().toString().equals(userData.getVerificationCode())) { UserDataWebAPITask udwTask = new UserDataWebAPITask(this, this); try {// w w w . ja v a2 s . com progDialog = ProgressDialog.show(this, "Processing...", "Fetching data", true, false); udwTask.execute("GET", getResources().getString(R.string.server_url) + "verify" + "?identifier=" + identifier + "&code=" + userData.getVerificationCode()); } catch (Exception e) { if (progDialog.isShowing()) { progDialog.dismiss(); } udwTask.cancel(true); } } else { DebugHelper.ShowMessage.t(this, "Verification Code did not match"); } }
From source file:com.lge.friendsCamera.CaptureIntervalActivity.java
/** * Get captureMode option and check the mode is 'interval' * If the mode is not interval, then ask user whether change captureMode as interval * API: /osc/commands/execute (camera.getOptions) *//* www . j a va2s. c o m*/ private void getOptionCaptureMode() { JSONObject parameters = new JSONObject(); try { //Set parameter for camera.getOptions JSONArray optionParameter = new JSONArray(); optionParameter.put("captureMode"); parameters.put(OSCParameterNameMapper.Options.OPTIONNAMES, optionParameter); OSCCommandsExecute commandsExecute = new OSCCommandsExecute("camera.getOptions", parameters); commandsExecute.setListener(new HttpAsyncTask.OnHttpListener() { @Override public void onResponse(OSCReturnType type, Object response) { try { if (type == OSCReturnType.SUCCESS) { //If the getOption request get response successfully, //check whether the mode is interval or not JSONObject jObject = new JSONObject((String) response); JSONObject results = jObject.getJSONObject(OSCParameterNameMapper.RESULTS); JSONObject options = results.getJSONObject(OSCParameterNameMapper.Options.OPTIONS); String captureMode = options.getString("captureMode"); if (!captureMode.equals("interval")) { //Ask user whether change captureMode as 'interval' or not // yes = Send request to captureMode as interval(camera.setOption) // no = finish this activity DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mProgressDialog = ProgressDialog.show(mContext, "", "Setting..", true, false); setCaptureModeInterval(); } }; DialogInterface.OnClickListener cancelListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ((CaptureIntervalActivity) mContext).finish(); } }; Utils.showSelectDialog(mContext, "Note: ", "Do you want to change captureMode to 'interval'?", okListener, cancelListener); } } else { Utils.showTextDialog(mContext, getString(R.string.response), Utils.parseString(response)); } } catch (JSONException e) { e.printStackTrace(); } } }); commandsExecute.execute(); } catch (JSONException e) { e.printStackTrace(); } }
From source file:com.commonsware.android.EMusicDownloader.SingleAlbum.java
private void getInfoFromXML() { //Show a progress dialog while reading XML final ProgressDialog dialog = ProgressDialog.show(this, "", getString(R.string.loading), true, true); setProgressBarIndeterminateVisibility(true); Thread t3 = new Thread() { public void run() { waiting(200);/*from w w w . j ava2s .c om*/ try { //Log.d("EMD - ","About to parse"); URL url = new URL(urlAddress); SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); XMLHandlerSingleAlbum myXMLHandler = new XMLHandlerSingleAlbum(); xr.setContentHandler(myXMLHandler); xr.parse(new InputSource(url.openStream())); //Log.d("EMD - ","Done Parsing"); statuscode = myXMLHandler.statuscode; if (statuscode != 200 && statuscode != 206) { throw new Exception(); } genre = myXMLHandler.genre; genreId = myXMLHandler.genreId; labelId = myXMLHandler.labelId; label = myXMLHandler.label; date = myXMLHandler.releaseDate; rating = myXMLHandler.rating; imageURL = myXMLHandler.imageURL; artist = myXMLHandler.artist; artistId = myXMLHandler.artistId; //Log.d("EMD - ","Set genre etc.."); numberOfTracks = myXMLHandler.nItems; trackNames = myXMLHandler.tracks; //sampleAddresses = myXMLHandler.sampleAddress; //sampleExists = myXMLHandler.sampleExists; //vSamplesExist = myXMLHandler.samplesExist; handlerSetContent.sendEmptyMessage(0); dialog.dismiss(); updateImage(); } catch (Exception e) { final Exception ef = e; nameTextView.post(new Runnable() { public void run() { nameTextView.setText(R.string.couldnt_get_album_info); } }); } //Remove Progress Dialog if (dialog.isShowing()) { dialog.dismiss(); } handlerDoneLoading.sendEmptyMessage(0); } }; t3.start(); }
From source file:com.nonstop.android.SoC.Facebook.Hackbook.java
@Override public void onItemClick(AdapterView<?> arg0, View v, int position, long arg3) { switch (position) { /*// w w w . ja v a2 s .c o m * Source Tag: upload_photo You can upload a photo from the media * gallery or from a remote server How to upload photo: * https://developers.facebook.com/blog/post/498/ */ case 0: { if (!Utility.mFacebook.isSessionValid()) { Util.showAlert(this, "Warning", "You must first log in."); } else { dialog = ProgressDialog.show(Hackbook.this, "", getString(R.string.please_wait), true, true); new AlertDialog.Builder(this).setTitle(R.string.gallery_remote_title) .setMessage(R.string.gallery_remote_msg) .setPositiveButton(R.string.gallery_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Intent.ACTION_PICK, (MediaStore.Images.Media.EXTERNAL_CONTENT_URI)); startActivityForResult(intent, PICK_EXISTING_PHOTO_RESULT_CODE); } }).setNegativeButton(R.string.remote_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { /* * Source tag: upload_photo_tag */ Bundle params = new Bundle(); params.putString("url", "http://www.facebook.com/images/devsite/iphone_connect_btn.jpg"); params.putString("caption", "FbAPIs Sample App photo upload"); Utility.mAsyncRunner.request("me/photos", params, "POST", new PhotoUploadListener(), null); } }).setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface d) { dialog.dismiss(); } }).show(); } break; } case 7: { if (!Utility.mFacebook.isSessionValid()) { Util.showAlert(this, "Warning", "You must first log in."); } else { new TokenRefreshDialog(Hackbook.this).show(); } } } }
From source file:ch.kanti_baden.pu_marc_14b.traffictimewaste.SORT_TYPE.java
private void setupRecyclerViewAsync(@NonNull final ViewGroup viewGroup) { final ProgressDialog progressDialog = ProgressDialog.show(this, getResources().getString(R.string.progress_loading_posts), getResources().getString(R.string.progress_please_wait), true, false); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); DatabaseLink.DatabaseListener listener = new DatabaseLink.DatabaseListener() { @Override/*from w w w . j a v a 2 s . c o m*/ void onGetResponse(String str) { final Post[] posts; try { JSONObject json = new JSONObject(str); posts = DatabaseLink.parseJson(json); } catch (JSONException e) { onError("JSON is invalid. Error: " + e.getMessage() + ", JSON: " + str); return; } if (progressDialog.isShowing()) progressDialog.dismiss(); final Post[] sortedPosts = sortPosts(posts); runOnUiThread(new Runnable() { @Override public void run() { // Inflate layout post_list View rootView = View.inflate(PostListActivity.this, R.layout.post_list, null); RecyclerView recyclerView = (RecyclerView) rootView.findViewById(R.id.post_list); // Setup refresh action SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) rootView .findViewById(R.id.swipe_refresh); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { recreate(); } }); // Set adapter with posts recyclerView.setAdapter(new SimpleItemRecyclerViewAdapter(sortedPosts)); // Add to ViewGroup viewGroup.addView(rootView); } }); } @Override void onError(String error) { if (progressDialog.isShowing()) progressDialog.dismiss(); new AlertDialog.Builder(progressDialog.getContext()).setTitle("Error").setMessage(error).show(); } }; Intent intent = getIntent(); if (Intent.ACTION_SEARCH.equals(intent.getAction())) DatabaseLink.instance.getPostsWithTag(listener, intent.getStringExtra(SearchManager.QUERY)); else DatabaseLink.instance.getAllPosts(listener); Log.v("TrafficTimeWaste", "Querying db..."); }
From source file:com.f16gaming.pathofexilestatistics.MainActivity.java
private void showProgress(CharSequence title, CharSequence text) { if (progressDialog != null) { progressDialog.setTitle(title);//ww w .j av a2 s . c o m progressDialog.setMessage(text); return; } progressDialog = ProgressDialog.show(this, title, text, true, false); }