android-alertdialog

AlertDialog vs AlertDialog.Builder

不打扰是莪最后的温柔 提交于 2021-02-18 05:33:50
问题 Why would one use the AlertDialog.Builder class rather than the methods directly available to AlertDialog , For example, why use AlertDialog.Builder.setCancellable rather than AlertDialog.setCancellable ? Surely this is a case of redundancy? 回答1: Because AlertDialog.setCancellable returns void and AlertDialog.Builder.setCancellable returns an AlertDialog.Builder . This means that the builder allows you to chain a bunch of settings with a little less verbosity. It's just a convenience class

Create a AlertDialog in Android with custom xml view

巧了我就是萌 提交于 2021-02-07 06:51:17
问题 How to create a dialog like this in Android? My idea is to create a custom xml view and inflate it into the dialog. any other suggestions? and what is the "drag line" at the middle of the dialog called? I really need that. Thanks in advance 回答1: Try below code for your reference: main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation=

how to add a dial number and press the `call` bottom?

末鹿安然 提交于 2021-02-05 12:20:51
问题 I want to trigger an intent that opens the dialer adds a number and then presses the call bottom. Is there any way to do the press bottom ? private void SendDialIntent() { Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + phone.phone)); startActivity(intent); } 回答1: You cannot "press the call button". You can use ACTION_CALL (instead of ACTION_DIAL ), which will directly place the phone call. This requires the CALL_PHONE permission and will not work for

how to add a dial number and press the `call` bottom?

亡梦爱人 提交于 2021-02-05 12:20:42
问题 I want to trigger an intent that opens the dialer adds a number and then presses the call bottom. Is there any way to do the press bottom ? private void SendDialIntent() { Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + phone.phone)); startActivity(intent); } 回答1: You cannot "press the call button". You can use ACTION_CALL (instead of ACTION_DIAL ), which will directly place the phone call. This requires the CALL_PHONE permission and will not work for

How to set round corners for a custom Dialog?

…衆ロ難τιáo~ 提交于 2021-02-04 06:20:05
问题 This is code for my custom Dialog: public class DialogBrightness extends AppCompatDialogFragment { @NonNull @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.layout_dialog, null); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); /*Build and create the dialog here*/ } } I followed instructions from other answers by first creating this drawable xml

How to set round corners for a custom Dialog?

折月煮酒 提交于 2021-02-04 06:16:21
问题 This is code for my custom Dialog: public class DialogBrightness extends AppCompatDialogFragment { @NonNull @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.layout_dialog, null); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); /*Build and create the dialog here*/ } } I followed instructions from other answers by first creating this drawable xml

Firebase signout is not leading to the correct activity

可紊 提交于 2021-01-28 09:00:55
问题 I tried to integrate an AlertDialog into my app via which the customer can log out. When I call up the dialog, it just works as it should be. However, if I press "log out" Iam not forwarded to the LoginActivity as requested. Instead, my dialog simply closes and the HomeActivity is reloaded. What am I doing wrong here? Greetings and thanks! private void signOut() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Signout") .setMessage("Do you really want to sign

Firebase signout is not leading to the correct activity

烈酒焚心 提交于 2021-01-28 08:44:17
问题 I tried to integrate an AlertDialog into my app via which the customer can log out. When I call up the dialog, it just works as it should be. However, if I press "log out" Iam not forwarded to the LoginActivity as requested. Instead, my dialog simply closes and the HomeActivity is reloaded. What am I doing wrong here? Greetings and thanks! private void signOut() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Signout") .setMessage("Do you really want to sign

How to add two edit text fields or views in an AlertDialog box?

孤街浪徒 提交于 2020-12-28 07:29:04
问题 I want to add two edit text fields in an alert dialog box. As simple as the solution sounds I have not been able to gather a working one as of yet. I am not able to set the two (edit text) views simultaneously. Please comment in case you want to see any further code. alertDialog.setTitle("Values"); final EditText quantity = new EditText(SecondScan.this); final EditText lot = new EditText(SecondScan.this); quantity.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);

Change Imageview of Alertdialog as per the result

坚强是说给别人听的谎言 提交于 2020-12-15 03:52:15
问题 I want to develop the UI in which user will touch the touch pad and if he is registered user of the system , he will be verified by my app. So to indicate that I want to change the fingerprint image by green (valid user) , red (invalid user). So I have created the fragment in which I am getting that result in following two methods @Override public void authenticate() { Log.d(TAG, "authoticate: "); result = "Yes"; //customBuilder.setImage(R.drawable.ic_fingerprint_pressed);//tried but not