I am developing an app similar to Shazam but with video.
My app have to process a video and in this time the display become all black. Is it possible to implement a "loading"? So while the phone elaborate the video I don't see black screen but a sort of loading page. Any suggestion? Thank you
You can do it simply by using a ProgressDialog:
ProgressDialog dialog=new ProgressDialog(context);
dialog.setMessage("message");
dialog.setCancelable(false);
dialog.setInverseBackgroundForced(false);
dialog.show();
And when you done with your process call:
dialog.hide();
Related
I have an android app written with Xamarin which needs to notify from a class that does not have good access to an activity or context, so I am using a System Alert dialog to display the message.
In Android 4.4, the pop-up appears and the user must tap the OK button to clear it. The rest of the screen is dim and the user cannot interact with any other UI elements until the pop-up is cleared. This is the desired behavior.
In Android 5.0 (tested on a Galaxy S6 and a tablet), the pop-up will appear for about one second and then disappear without requiring any interaction whatsoever. I have done a number of Google and SO searches to no avail.
private static void ShowSystemAlert(Context context, string message)
{
var dialog = new AlertDialog.Builder(context, Android.Resource.Style.ThemeHoloLightDialog)
.SetNeutralButton("OK", (alertSender, args) => {})
.SetMessage(message)
.Create();
dialog.SetCanceledOnTouchOutside(false);
dialog.Window.SetType(WindowManagerTypes.SystemAlert);
dialog.Show();
dialog.Window.DecorView.SetBackgroundResource(Android.Resource.Color.Transparent); //remove strange small border around dialog
}
How can I get the pop-up to work like it does in Android 4.4? The best answer will work in Lollipop, Marshmallow, and Nougat.
I would also very much appreciate an explanation as to why this happened, or any background information you can give. Thanks!
Is it xamarin? Create your alertdialog with just the context, don't use the theme.
I have a requirement to display the different stages of a Process in a dialog box overlay on the mobile app such as "Process 1 started" "Process 1 completed" "Process 2 started" and so on until the process is completed.
Essentially, what I'm looking for is scrollable text in an overlay screen appearing as the app receives different notifications(BLE characteristics). No user interaction required. Is there an out-of-the-box dialog box control that I can use? Any other suggestions for such a display?
U can add the DialogFragment and
if(process1.isDone())
{
informationOnDialogFragment
}
if(process2.isDone())
...
But the easiest way is add ProgressDialog
U can set message to ProgressDialog
You can achieve it using simple toast or other innovative libraries like:
1. EFInternetIndicator
2. FTIndicator
You can use Progress Dialog . With progress.setCancelable(false); you can make it so the user can`t navigate away from the dialog.
I have used Google Place Picker API in my app
So Place Picker takes time to load, so I want to use ProgressBar for a certain time till the api is completely loaded
and is there any way to work with complex UI
for eg my main page contains lots of data and it takes around 5-6sec to completely load it,so is there a way to add progressbar over there also?
please Help i am new to android
Declare your progress dialog:
ProgressDialog progress;
When you're ready to start the progress dialog:
progress = ProgressDialog.show(this, "dialog title",
"dialog message", true);
and to make it go away when you're done:
if (progress != null) {
progress.dismiss();
}
G'day,
I've got a (Spinner) Progress Dialog showing in my Android code, but it seems to have a background dialog, as you can see in this picture:
(Don't worry about the black box/gradient, it was closing by the time ddms caught it)
The code used to open it is:
loading = new ProgressDialog(this,ProgressDialog.STYLE_SPINNER);
loading.setMax(1);
loading.setTitle("Loading...");
loading.setMessage("Getting posts...\nThis may take a while depending on your internet connection.");
loading.setCancelable(false);
loading.setIndeterminate(false);
// ...
loading.setProgress(0);
loading.show();
Is there something I'm doing wrong or something I can do to stop that happening?
Cheers.
I am new to Android. In my application I want to add an process bar(an image), this should indicate that something is in process and after completion hide this precess bar.
As if i add user detail, On click on add button this process bar should be displayed.
How can i do it, please suggest.
Thanks.
Code I used:
progressDialog = ProgressDialog.show(AddTicketActivity.this, "", "Loading...");
new Thread() {
public void run() {
try{
sleep(10000);
} catch (Exception e) {
Log.e("tag", e.getMessage());
}
progressDialog.dismiss();
}
}.start();
The problem with it is , it is hardcoded sleep(10000) whereas what i want is it to be dependent on how much time my process takes to add or fetch data.
I am not getting where to put code which is executing on onclick of button.
I hope you got my point
Thanks again.
For that you can use either ProgressDialog or ProgressBar.
Now, To display Progress bar and during that perform task in background, you should implement AsyncTask.
In onPreExecute() method, display the ProgressBar or make it visible again like: progressbar.setVisibility(View.VISIBLE);
In doInBackground() method, perform the background task, i.e. add user detail in your case
In onPostExecute() method, just hide the ProgressBar using the progressbar.setVisibility(View.INVISIBLE);
Well if you just want to show an image, you can place it on a RelativeLayout with visibility=gone
and then just control when to show or hide it.
another way is the typical progressDialog in Android
Or use a progress bar (spinning wheel) it's more user friendly and droid friendly .
Take a look at the Form widgets on Eclipse .