Hi im invoking a simple progress bar in android with the following code
MyDialog = ProgressDialog.show(attraction_more_info.this, " " ,
" Loading. Please wait ... ", true);
The thing is when it comes up there is a small white circle with a white triangle in it above the spinning icon. How do i get rid of this so it is only the spinning circle and the text.
it looks like the following image although myne does not say the "indeterminate" part.
(source: lytsing.org)
Probably something simple to get rid of it.
Thanks
Remove the space in between the "" after attraction_more_info.this. It's the title. You can enter anything within the double quotes but its optional. E.g. Retrieving Information
From this:
MyDialog = ProgressDialog.show(attraction_more_info.this, " " ,
" Loading. Please wait ... ", true);
Into this:
MyDialog = ProgressDialog.show(attraction_more_info.this, "" ,
" Loading. Please wait ... ", true);
Go for this instead,
MyDialog = ProgressDialog.setMessage("Loading. Please wait...");
This will provide you with your expected result.
Related
I have written some code for showing a Dialog box using sweet alert library. It's a very popular library and contains couple of awesome features which are very useful for designing purpose and developing purpose as well. So please help to change the background color of Action button which are present at the bottom of the dialog box.
I am attaching the screen shot and as well as code. Please help me to fix this issue.
I only want to change the background color of Action Button.
MaterialDialog.Builder builder = new MaterialDialog.Builder(SignInActivity.this)
.title("Sign Up")
.titleColor(Color.BLACK)
.customView(R.layout.custom_dialog_sign_up, true)
.positiveText("Submit")
.negativeText("Cancel")
.positiveColorRes(R.color.black_color)
.negativeColorRes(R.color.gray_btn_bg_color)
.canceledOnTouchOutside(false)
.autoDismiss(false);
final MaterialDialog materialDialog = builder.build();
materialDialog.show();
it is pretty late to respond upon your question but, recently i face this issue and start digging about it on google but found nothing, so i started my own and found this perfect solution code and screen shot attached.
SweetAlertDialog sweetAlertDialogView;
sweetAlertDialogView = new SweetAlertDialog(ctx,SweetAlertDialog.ERROR_TYPE);
sweetAlertDialogView.setTitleText(ctx.getResources().getString(R.string.error_msg_oops_title))
.setContentText("Request failed :" + errMsg + " \n" + ctx.getResources().getString(R.string.error_msg_check_net_connection));
sweetAlertDialogView.show();
Button viewGroup = (Button) sweetAlertDialogView.findViewById(cn.pedant.SweetAlert.R.id.confirm_button);
if (viewGroup != null) {
Log.e(TAG, "showErrorMsg: Button view Found yep");
viewGroup.setBackgroundColor(viewGroup.getResources().getColor(R.color.colorSkyBlueButtonLoader));
} else {
Log.e(TAG, "showErrorMsg: Button view Null :( ");
}
from above logic i update the button color to dark sky blue blue, for any other help you can ask me in comment. i will try to resolve it with my best.
A far more easier way to accomplish this is to just overwrite following color values in your color.xml:
<color name="blue_btn_bg_color">#1976D2</color>
<color name="blue_btn_bg_pressed_color">#1565C0</color>
I want to integrate text widget in my application in android studio. I tried running the samples and they are working fine. Now i want to toast the digital text that appears after user input. I want to save that text somehere. I used this code in OnRecognitionEnd() function
#Override
public void onRecognitionEnd() {
String Result = mEditText.getText().toString();
Log.d(TAG, "result is: " +Result);
}
Now can you kindly tell me I want to display the text that is being stored in “Result” I used multiple ways but it says UNFORTUNETLY THE APPLICATION HAS STOPPED. For Example i simply did this
TextView textElement = null;
textElement.setText(Result);
Please tell me what I am doing wrong what should i do to display it ?
If you do this :
TextView textElement = null;
textElement.setText(Result);
You will try to setText on null. I suppose the error in your logcat is NullPointerException.
You have to instantiate your textElement.
TextView textElement=(TextView)findViewById(R.id.myid);
Where "myid" is the id in your layout.xml.
In my app, I'm downloading a small Facebook profile picture and show it in an AlertDialog (as BitmapDrawable) along with the user first and last name.
Now, my problem is that on some devices the BitmapDrawable is shown in the AlertDialog (Android ~4.0) and on some it isn't (5.0 and above), but in all the devices the BitmapDrawable contains the right bitmap and I'm able to load that BitmapDrawable to an ImageView for example.
((ImageView)findViewById(R.id.imageView3)).setImageDrawable(bitmapDrawable); //Shown in the ImageView on all devices
AlertDialog ad = new AlertDialog.Builder(MainActivity.this)
.setTitle("From: " + name + " " + lastName)
.setMessage(theStr)
.setNeutralButton(theStr2, new myClick(marker, thePack))
.setIcon(bitmapDrawable) //Not shown in the AlertDialog on all devices
.show();
Any idea?
UPDATE: Even in the debugger I can see the icon set in the AlertDialog and the debugger also allow me to view the bitmap of it and it's shown perfectly. It's just won't show up in the dialog and I don't know why.
Try setting a drawable from the resource just to see if that works.
If I'm not wrong try changing the default app theme (It's weird but for me it worked in some special cases).
Also I've found this bug report while searching,
https://code.google.com/p/android/issues/detail?id=92929
I want to use links in android dialog and i ran into this weird problem, if i use this:
String part1 = "http://google.com";
String part2Label = "http://tests.fr";
tx1.setText(Html.fromHtml("" + part1Label + "<br>" ) );
tx1.setAutoLinkMask(RESULT_OK);
tx1.setMovementMethod(LinkMovementMethod.getInstance());
It works, but if i change the part1Label to "normal text", it stops working.
Did anyone ran into this issue before? I thought just using Html.fromHtml takes care to interpret of any html elements that i would like to use.
Thank you
I don't know if it's related (since you've said it works in the first option), but you have a couple of "" missing:
tx1.setText(Html.fromHtml("" + part1Label + "<br>" ) );
should be:
tx1.setText(Html.fromHtml("" + part1Label + "<br>" ) );
I decided to learn a little bit android progrramming and by using Eclipse + android plug-in I made an android "hello world" application. After that I tryed something simple and used 3 TextViews:
ID:TextView1 String-Value:A=5
ID:TextView2 String-Value:B=10
ID:TextView3 String-Value:A+B=C=
I created them in main.xml menu by drag and drop so, to show them I'm using the flowing line:
setContentView(R.layout.main);
The Question is: I want to get string values of A and B and append the result of 5+10 to the string value of C actualy I did it but it take too much codes just for get str value of a TextView and editing it. Is there any short way like in .Net?
string Str = This.Label1.Text();
And is eclipse is the best IDE or am I should use something else?
When I have several textviews etc, Why am I should write unnecessary lines if there is a short way to do it.
Another Question is I get str-value of B which is 10 but when I tryed the same thing for A it says there is nothing inside VarAStr
*My Codes are:*
setContentView(R.layout.main);
TextView VarAStr = (TextView)findViewById(R.id.VarA);
TextView VarBStr = (TextView)findViewById(R.id.VarB);
TextView VarC = (TextView) findViewById(R.id.VarC);
try{
int VarA=Integer.parseInt(VarAStr.getText().toString().substring(2));
int VarB=Integer.parseInt(VarBStr.getText().toString().substring(2));
VarC.append(String.format("%d", (VarA+VarB)));
}
catch(Exception e){
Toast.makeText(this, e.toString() + " -" + VarAStr.getText().toString() + "-", Toast.LENGTH_LONG).show();//Show();
}
For the last question I found a bad code line in main.xml :) wich has no android:text="#string/VarA" I added this and problem solved.
Thank you for any respond.
You can always put the repeated code on a function that returns a string.
Something like:
public String getTextOfView(int id) {
TextView tmp = (TextView)findViewById(id);
return tmp.getText.toString();
}