Android custom dialog - Create Android Alertdialog with a custom layout

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 228

  • @miles2code366
    @miles2code366 7 лет назад +14

    You are different to most teachers on RUclips. And that is a good thing.
    People teaching how to do stuff often forget to explain why they are writing this piece of code, you explain it all. AND It's great.
    I've subscribed + thanks!

    • @CodingDemos
      @CodingDemos  7 лет назад +2

      Hi Thomas, thanks a lot for the kind words...i'm really happy that you found my videos helpful
      Thanks for watching and subscribing :)

  • @AlineSelle
    @AlineSelle 4 года назад +4

    Thank you soo much! I spent long long time trying to understand why I couldnt access my views without relating them into the inflate Layout using mView ! And then Bingo, finally I found your video and you helped me a lot with this!

    • @walidpivano117
      @walidpivano117 4 года назад

      I meet an error in this example
      attempt to invok oncllikListener on a null obect refrence

    • @AlineSelle
      @AlineSelle 4 года назад +1

      Hello@@walidpivano117 , in this case I would ask myself the following: 1.Did I really create a view in my XML popup file? Did I give it an id? Did I call it as said in the video by using the ".view" before the findViewById(ex TextView textView = view.findViewById(R.id.myTextViewId); Did I set the view with alertDialog method setView? example: alertDialog.setView(view); Finally did I type alertDialog.show()? I hope my own questions can help you to resolve your 'null object reference'. Good luck!

    • @walidpivano117
      @walidpivano117 4 года назад +1

      Ohhh thanks man
      Because of you I find my error thats was so helpful i forgot v.find...
      Thanks you 💪❤

  • @nikolaistavrogin6256
    @nikolaistavrogin6256 7 лет назад +1

    maaaaaa negga. You're like Jesus to me right now. You don't know how much this has been helpful. Thanks!

    • @CodingDemos
      @CodingDemos  7 лет назад

      Awesome i'm glad you found it helpful :)

  • @Daniel-go7lx
    @Daniel-go7lx 6 лет назад

    Thank you so much! This tutorial was very intuitive, easy to follow, and easily applied to other situations. I used it with a ListView.

  • @markonovakovic3838
    @markonovakovic3838 7 лет назад

    Great explaining and good example. Great job! I feel like am watching paid content.

  • @igorspfc56
    @igorspfc56 4 года назад

    Thanks, I don't understand your language but it helped me a lot.

  • @muhammadtalha2363
    @muhammadtalha2363 7 лет назад +8

    I wanted to hit 1k likes but Unfortunately i only had thumb up
    Thankyou and that one was amazing helpful nd easiest explained video

    • @CodingDemos
      @CodingDemos  7 лет назад +1

      hahaha..Thanks for watching :)

  • @rotens2rt
    @rotens2rt 7 лет назад

    Thanks a lot. Respect from Mexico.

  • @davidvazquezmontejano2874
    @davidvazquezmontejano2874 7 лет назад +1

    WAWWW this tutorial os soooo good. Thanks a lot, i was lokking for exactly this tutorial

    • @CodingDemos
      @CodingDemos  7 лет назад

      Cool, i'm glad to hear that :)

  • @DrGabelstapler
    @DrGabelstapler 4 года назад

    Danke Lieber GOTT.... greetings from germany

  • @josephmaclen2410
    @josephmaclen2410 7 лет назад

    Awesome job dude! You explain very well

  • @maribelmaligno5398
    @maribelmaligno5398 7 лет назад +1

    i really love your tutorials easy to learn . thanks for this :)

  • @yatendra__singh
    @yatendra__singh 5 лет назад

    Really an awesome explaination,w want more tutorial from you, thanks

  • @player6769
    @player6769 6 лет назад

    I know this is an old video but great tutorial!

  • @haifasaleh5440
    @haifasaleh5440 7 лет назад

    Thanks sir that was clear and helpful tutorial

  • @mangkukperkasa6598
    @mangkukperkasa6598 5 лет назад

    terima kasih. penerangan yang amat bagus sekali.

  • @mohammedviso2269
    @mohammedviso2269 7 лет назад

    Great tutorial ...... Thanks my friend

  • @erdinandapandu3055
    @erdinandapandu3055 7 лет назад

    Thanks! this one is very helpful. and you just got one new subscriber :)

  • @CharlExMachina
    @CharlExMachina 4 года назад

    This worked wonderfully. Thanks!

  • @Vaviorky
    @Vaviorky 8 лет назад +1

    Thank you very much, very good explanation!

  • @stylersito
    @stylersito 7 лет назад

    amazing thanks! Greetings from Mexico

  • @AndroidHacksAH
    @AndroidHacksAH 7 лет назад +2

    Thank you this is easy than I expected

  • @technicalskillz
    @technicalskillz 5 лет назад

    how to dismiss after login button clicked because there is not any method to dismiss that dialog???

  • @leogomes121
    @leogomes121 4 года назад

    Thanks for this. great job, man

  • @wogalwogal
    @wogalwogal 7 лет назад +1

    nice ty ,, just what i needed ,,
    you explain very well

  • @DanaiKamvoussiora
    @DanaiKamvoussiora 4 года назад +1

    Great video!
    Just one question. I changed the font on my edit texts from the custom dialog layout, but I want to change the font of the dialog title and the positive/negative buttons. Is there a way to do that? Also I would like to create a radius for the dialog box!
    Thank you

  • @scriptgo9088
    @scriptgo9088 4 года назад

    Thank you very much, great tutorial!.
    How to controller disapper buttons in rotation lanscape.

  • @RolyHun
    @RolyHun 5 лет назад

    Thank you for this tutorial, it really helped me out.

  • @p32929
    @p32929 7 лет назад +4

    Thank you so much for this amazing video...
    #Subscribed :)

    • @CodingDemos
      @CodingDemos  7 лет назад +3

      Thanks for watching and subscribing to the channel :D

    • @p32929
      @p32929 7 лет назад

      You're most welcome ^_^

  • @thegreenmonster650
    @thegreenmonster650 6 лет назад

    amazing man.... Hats off....

  • @hasforjsnidea7757
    @hasforjsnidea7757 7 лет назад +1

    Thanks for the video, very usefull :)

  • @Pellegrini159
    @Pellegrini159 7 лет назад

    Thanks A LOT !! You saved me with this!

  • @luanmuruk677
    @luanmuruk677 6 лет назад

    Ajudou muito, muito obrigado pela explicação simples e efetiva, me inscrevi no canal para acompanhar as novidades.

  • @renzogf1103
    @renzogf1103 7 лет назад +1

    Gracias, me fue de mucha ayuda.

  • @MrJohnabrown
    @MrJohnabrown 6 лет назад

    Nicely done!

  • @anupamprakash9039
    @anupamprakash9039 7 лет назад +1

    You could use preview rather than going to design view every time to check the design.

    • @CodingDemos
      @CodingDemos  7 лет назад +1

      Cool thanks for pointing that out :) i'll use it next time

  • @shahriarsharif6736
    @shahriarsharif6736 4 года назад

    Thank you very much.

  • @YogendraSingh-jh1lz
    @YogendraSingh-jh1lz 7 лет назад

    Instantly Subscribed :)

  • @rroossyyiidd
    @rroossyyiidd 7 лет назад

    Thanks a lot.. very helpfull..

  • @sergeperrin45
    @sergeperrin45 6 лет назад

    Merci pour ce petit tuto.

  • @alexandreoliveira7356
    @alexandreoliveira7356 8 лет назад

    Thanks a lot. Your explanation is so great.
    Just one doubt, how can I dismiss this dialog, please?

    • @CodingDemos
      @CodingDemos  8 лет назад +4

      To dismiss the dialog you just call dialog.dimiss(). For example if you want to dismiss the dialog when the user have successfully filled email, password field and clicks on "Login button" you do it like this:
      - First you show the dialog like this:
      final AlertDialog dialog = mBuilder.create();
      dialog.show();
      - Then you call setOnClicklistener for the login button like this:
      mLogin.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View view) {
      if(!mEmail.getText().toString().isEmpty() && !mPassword.getText().toString().isEmpty()){
      Toast.makeText(MainActivity.this,
      R.string.success_login_msg,
      Toast.LENGTH_SHORT).show();
      dialog.dismiss();
      }else{
      Toast.makeText(MainActivity.this,
      R.string.error_login_msg,
      Toast.LENGTH_SHORT).show();
      }
      }
      });
      Happy coding :)

    • @alexandreoliveira7356
      @alexandreoliveira7356 8 лет назад +1

      Coding Demos Tks só much, man ;)

    • @revolutionradio3270
      @revolutionradio3270 7 лет назад

      did it work for you

  • @tinski
    @tinski 6 лет назад

    Thank you very much, great tutorial!

  • @gustavolinares4015
    @gustavolinares4015 6 лет назад +1

    big thank man, this really work for me

    • @CodingDemos
      @CodingDemos  6 лет назад

      That's awesome, happy coding :D

  • @mohammedhamouda104
    @mohammedhamouda104 7 лет назад +1

    hey bro, awesome work,
    but I have a question how to dismiss like in the normal dialog video.

    • @mohammedhamouda104
      @mohammedhamouda104 7 лет назад +1

      I have done it, just make the dialog object global and dismiss it from inside the log in button handler.

    • @CodingDemos
      @CodingDemos  7 лет назад +1

      That's awesome :)

    • @dmelton_yt
      @dmelton_yt 6 лет назад

      what was your code to do that?

  • @fatninja6099
    @fatninja6099 6 лет назад

    This was awesome .. Thanks a lot.

  • @l.aguirre5550
    @l.aguirre5550 4 года назад

    gracias. . como hago al final despues de presionar el boton login desaparezca el layout creado??

  • @ravidrinek2863
    @ravidrinek2863 7 лет назад

    great tutorial! thanks

  • @vamshikrishnathegeek
    @vamshikrishnathegeek 7 лет назад +1

    Excellent Tutorial!.. Thanks! .
    Subscribed!

  • @AMeier-cp6bi
    @AMeier-cp6bi 7 лет назад +1

    Thanks very much for the great tutorial. I still wonder how I can wait
    for the dialog to be dismissed and then access and use the input for
    Email and Password? That would help me a lot!

    • @CodingDemos
      @CodingDemos  7 лет назад

      Hi, if i understand your question correctly the dialog will not be dismissed unless you actually write the code for it.
      For example you can dismiss the dialog when the user have successfully entered the email and password then you call dialog.dismiss()
      Based on the example provided in the video you can call dialog.dismiss after the successful login toast message which will hide the dialog.
      I hope that answered your question :)

    • @AMeier-cp6bi
      @AMeier-cp6bi 7 лет назад

      Sorry, my question was not precise enough. The functionality you describe works fine and the dialog is properly dismissed. But AFTER dismissing the dialog I need to use the input from within the dialog in the "calling program".
      Problem 1: the calling program doesn't wait for user input and dismissal
      Problem 2: i can't get the email/password-input out of the inner onClick-method and pass it to the calling program
      my current code:
      (...)
      String password;
      Button mShowDialog = (Button) findViewById(R.id.btnShowDialog);
      mShowDialog.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
      AlertDialog.Builder mBuilder = new AlertDialog.Builder(MainActivity.this);
      View mView = getLayoutInflater().inflate(R.layout.dialog_login,null);
      final EditText mEmail = (EditText) mView.findViewById(R.id.etEmail);
      final EditText mPassword = (EditText) mView.findViewById(R.id.etPassword);
      Button mLogin = (Button) mView.findViewById(R.id.btnLogin);
      mBuilder.setView(mView);
      final AlertDialog dialog = mBuilder.create();
      dialog.show();
      mLogin.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
      if (!mEmail.getText().toString().isEmpty() &&
      !mPassword.getText().toString().isEmpty()) {
      Toast.makeText(MainActivity.this, R.string.success_login_msg, Toast.LENGTH_SHORT).show();
      dialog.dismiss();
      } else {
      Toast.makeText(MainActivity.this, R.string.error_login_msg, Toast.LENGTH_SHORT).show();
      }
      }
      });
      password = mPassword.getText().toString();
      }
      });
      Toast.makeText(MainActivity.this,"Passwort ist "+password, Toast.LENGTH_SHORT).show();
      The Toast-Command displays right at startup of the app, even before the alert
      diaglog is created. This code doesn't even compile because any variable
      (like password) from within the inner onClick method isn't visible in the
      last line of code or it is not accessible in the onClick method.
      Help!

    • @revolutionradio3270
      @revolutionradio3270 7 лет назад

      hi did you ever figure it out

    • @BrovkoCo
      @BrovkoCo 7 лет назад

      When you add the dialog.dismiss() an error happens saying that it can not resolve symbol. I am having the same issue as A. Meier where after everything is successfully done, I am not sure as to how close the dialog. If you could elaborate on what you said you give some insight on how to solve this problem that would be great.

  • @vlle.2567
    @vlle.2567 6 лет назад

    very helpful! thanks!

  • @akshg05
    @akshg05 6 лет назад

    Amazing video!!

  • @abhigyanraha5620
    @abhigyanraha5620 6 лет назад

    awesome video!

  • @uarriaga
    @uarriaga 5 лет назад

    thanks you very much

  • @ademmehdioui6111
    @ademmehdioui6111 7 лет назад +1

    thank you very much , this video is usefull

  • @kaiz3nberg
    @kaiz3nberg 7 лет назад +1

    Hello sir. i had a query. If i wanted the button on the dialog to redirect me to a different page how do i implement it? For example if i had a modify button on the dialog which takes me to a different page, how will it work?

    • @CodingDemos
      @CodingDemos  7 лет назад

      Hi, inside mLogin onClick method you add the following code:
      startActivity(new Intent(MainActivity.this, NewActivity.class));
      Note: (NewActivity.class) is the page that you want to send the user to.

  • @revolutionradio3270
    @revolutionradio3270 7 лет назад

    this is a great tutorial the only thing i wish you would show is how to close the alertdialog after successful login

    • @techgalaxy8382
      @techgalaxy8382 7 лет назад

      Right Way Entertainment Ajay Sajeev declare the Alert Dialog as a Global Variable and inside the onClickListener type the name of the global Variable and put the cancel button
      // Global Variable
      AlertDialog ad;
      ........
      onClick{
      ad.cancel
      }
      You surely need to look up at Stack overflow....Even I checked it.

  • @b.k4142
    @b.k4142 6 лет назад

    key statement
    - getLayoutinflater
    - mBuilder.setView(mView)
    - dialog = mBuilder.create();
    - dialog.show()

  • @christeensaad9775
    @christeensaad9775 6 лет назад

    can i add recyclerview in dialog
    or what is the best way to put recyclerview in popup

  • @aliakkawi4759
    @aliakkawi4759 7 лет назад

    Thanks a lot.

  • @ahmadalmaghraby7792
    @ahmadalmaghraby7792 7 лет назад +1

    I have created a dialog like this , but at onClickListener method I have a variable that its value is changing and it giving me an error saying "Variable is accessed within inner class. Needs to be declared final"
    I can't declare it final because its value is changing
    what should I do please?

    • @CodingDemos
      @CodingDemos  7 лет назад

      Hi, in that case you can declare that variable on top not inside any inner method, so that you can reference that variable without declaring it as final

  • @RankiandoNasProvas
    @RankiandoNasProvas 6 лет назад +2

    How do I close a dialog box after clicking on the button?

  • @AshishSharma-em9sk
    @AshishSharma-em9sk 7 лет назад +1

    I want to go to another activity click on a button on the dialog box. I am trying but not able to move it there I think because it is layout resource file. I just want to work with this dialog box work on click event. please help me.

    • @CodingDemos
      @CodingDemos  7 лет назад +3

      Hi, you don't have to make any changes in the layout resource file, based on the video there is a login button so let's say you want to go to another activity whenever the user taps on the button, you can do it like this:
      Inside the mLogin.setOnClickListener method replace the the toast message with the following line: startActivity(new Intent(MainActivity.this, NewActivity.class));
      Now when the user taps on the login button it will send the user to another page.
      I hope that helps :)

  • @marcelogamer3214
    @marcelogamer3214 7 лет назад

    Perfect! Thank you!

  • @sergindreu3848
    @sergindreu3848 7 лет назад +1

    Hey I have a problem!
    When I click edittext the keyboard doesn't show the input doesn't work .

    • @CodingDemos
      @CodingDemos  7 лет назад

      Hi, hmm that's strange! Do you see any errors in logcat? You can email me (codingdemos@gmail.com) the source code so that i can see what is the issue

    • @sergindreu3848
      @sergindreu3848 7 лет назад +1

      Coding Demos Thanks For This Tutorial it Helped Me A lot .Anyway how can I close this dialog using a button? Coz the dismiss doesn't work !

    • @CodingDemos
      @CodingDemos  7 лет назад +1

      First you need to show the alertdialog and then call button setOnClickListener to make the button clickable. Inside the OnClick method is where you will dismiss the dialog like this:
      final AlertDialog dialog = mBuilder.create();
      dialog.show();
      mLogin.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View view) {
      if(!mEmail.getText().toString().isEmpty() && !mPassword.getText().toString().isEmpty()){
      Toast.makeText(MainActivity.this,
      R.string.success_login_msg,
      Toast.LENGTH_SHORT).show();
      dialog.dismiss();
      }else{
      Toast.makeText(MainActivity.this,
      R.string.error_login_msg,
      Toast.LENGTH_SHORT).show();
      }
      }
      });

    • @sergindreu3848
      @sergindreu3848 7 лет назад +1

      Thanks Man ! I subscribed !!!!

    • @CodingDemos
      @CodingDemos  7 лет назад

      Your welcome and thanks for subscribing :)

  • @saadahmed4083
    @saadahmed4083 7 лет назад +5

    How to add also cancel button in this custom dialog?

    • @CodingDemos
      @CodingDemos  7 лет назад +5

      Hi, create a button inside the dialog_login.xml file and you can place it under the login button, then declare the cancel button inside alertdialog like i did for the login button. Inside the cancel button's onClick method you can dismiss the dialog like this:
      final AlertDialog dialog = mBuilder.create();
      dialog.show();
      mCancel.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View view) {
      dialog.dismiss();
      }
      });

    • @saadahmed4083
      @saadahmed4083 7 лет назад +1

      Thanks

    • @CodingDemos
      @CodingDemos  7 лет назад +1

      Your welcome :)

  • @kaew2570
    @kaew2570 5 лет назад

    Thanks a lot;

  • @andersonnogueira1883
    @andersonnogueira1883 5 лет назад

    Valeu amigo. Me ajudou muito. Obrigado

  • @AwsRh
    @AwsRh 8 лет назад

    thanks a lot

  • @juliocamacho6298
    @juliocamacho6298 5 лет назад

    excelent :D thank you

  • @md.shafiqulislam15
    @md.shafiqulislam15 6 лет назад

    super tutorial

  • @user0m170
    @user0m170 7 лет назад +1

    Thanks mate!

  • @abderrahmenebouidia3212
    @abderrahmenebouidia3212 7 лет назад +1

    hi thank you very much for this tutorial,
    can you just show us how to dismiss the dialog because i am trying with dialog.dismiss() but it doesn't work

  • @renzomenpin5736
    @renzomenpin5736 7 лет назад +1

    I copied the source code but the result of the alert dialog is in full screen. How can i minimize and adjust it to center? Thanks

    • @CodingDemos
      @CodingDemos  7 лет назад

      Hi, please email me (codingdemos@gmail.com) the source code so that i can see what's the problem

  • @nomanshahid1862
    @nomanshahid1862 7 лет назад

    thank you bro

  • @codeline3658
    @codeline3658 7 лет назад +1

    Good Video!, I have a question, How can I prevent that the dialog closes when I touch outside it?

    • @CodingDemos
      @CodingDemos  7 лет назад +1

      Hi, you can call mBuilder.setCancelable(false)

  • @krishnakulkarni1330
    @krishnakulkarni1330 7 лет назад +1

    Can you explain How to set custom Layout on Item click Listener of Recyclerview

    • @CodingDemos
      @CodingDemos  7 лет назад

      Hi, please check out the new tutorial about Recyclerview: ruclips.net/video/RIoyRhlo5Oo/видео.html

  • @dmelton_yt
    @dmelton_yt 6 лет назад

    Great tutorial! Thank you a lot!

  • @rowanberry3169
    @rowanberry3169 5 лет назад

    My biggest complaint with this video is that it does not show you any useful use case for the button. For example, how do you get the login button to close the dialog on success? (Showing a toast is pretty useless imo), How do I get and set the values of these editTexts? Though it's just a case of accessing their variables it would make this video complete

  • @Manikandan-qc7ei
    @Manikandan-qc7ei 4 года назад

    My dialog layout widgets Id will not shown here. How to solve it?.

  • @DanielAnderssson
    @DanielAnderssson 5 лет назад +1

    Good but you forgot the most important part, how to close it. Don't work with dismiss()

    • @DanielAnderssson
      @DanielAnderssson 5 лет назад

      I got it to work define AlertDialog dialog as final. "final AlertDialog dialog = mBuilder.create();" Then you can call dismiss(). Like someone answered here: stackoverflow.com/questions/49349668/how-to-dismiss-custom-alert-dialog

  • @darawshahassan3833
    @darawshahassan3833 7 лет назад +1

    stuck with the (" else ", unexpected token) with a red line, what is the problem!
    how can i get the code?
    thank you for this helpful video :)

    • @CodingDemos
      @CodingDemos  7 лет назад

      Hi, you can access the source code at this link: github.com/codingdemos/CustomAlertDialogTutorial
      Please let me know if you need any help with the code above

  • @md.rajibulislamshopnil2260
    @md.rajibulislamshopnil2260 7 лет назад +1

    *_Thanks for this video_*

  • @skatestyle1930
    @skatestyle1930 7 лет назад +1

    Thanks alot!

  • @danielcardona5452
    @danielcardona5452 6 лет назад

    Thank you

  • @MuhammadAsif-py6ck
    @MuhammadAsif-py6ck 7 лет назад

    can you please make a tutorial on how to enable pop ups by default for web app. because my website need pop ups enable to open after login. i already make app for that website but after login it shows nothing not even pop ups notification.

  • @alexanderbajade7485
    @alexanderbajade7485 7 лет назад +1

    hey men can you do a tutorial that combine two application in one? btw this is helpful vid goodjob

    • @CodingDemos
      @CodingDemos  7 лет назад

      Hi, thanks for watching :)
      Sorry what do you mean by "combine two application in one"?

    • @alexanderbajade7485
      @alexanderbajade7485 7 лет назад

      Like i create app A and the other app B is a source code is it possible to combine those 2 app in one?

  • @Destroyer19941995
    @Destroyer19941995 5 лет назад

    Hey I have created two buttons and I did exact same thing as you but my onClickListener is not working at all.

    • @CodingDemos
      @CodingDemos  5 лет назад +1

      Hi, do you get any error message in the logcat?

    • @Destroyer19941995
      @Destroyer19941995 5 лет назад

      @@CodingDemos I fixed it. I had to put onClickListeners after dialog.show(); not before.

    • @CodingDemos
      @CodingDemos  5 лет назад

      Awesome :)

  • @BrovkoCo
    @BrovkoCo 7 лет назад +1

    Any text inputed into the Editext shows up as null.
    AlertDialog.Builder mBuilder = new AlertDialog.Builder(HomePage.this);
    View mView = LayoutInflater.from(HomePage.this).inflate(R.layout.dialog_new_post, null); //does not work when u try to do it the way u have it in your video
    EditText etNewPostDialog = (EditText) mView.findViewById(R.id.etNewPostDialog);
    Button btnCreatePostDialog = (Button) mView.findViewById(R.id.btnNewPostDialog);
    final String newPostDialog = etNewPostDialog.getText().toString().trim();
    final String username = SharedPrefManager.getInstance(this).getUsername();
    // final String post = etNewPostDialog.getText().toString();
    btnCreatePostDialog.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
    //sendUserPost(username);
    Toast.makeText(HomePage.this, newPostDialog, Toast.LENGTH_SHORT).show();
    }
    });
    mBuilder.setView(mView);
    AlertDialog dialog = mBuilder.create();
    dialog.show();
    }
    So far every way I have tried it has returned null. Also side question how would you close the dialog. Thanks for the help thus far tho

    • @CodingDemos
      @CodingDemos  7 лет назад

      Hi, do you get any error in the logcat when you try to insert a value in the edittext?
      and may i know why this line doesn't work (View mView = getLayoutInflater().inflate(R.layout.dialog_login, null);) do you get any errors?
      You can email me (codingdemos@gmail.com) your project code and i'll do my best to help you :)

    • @BrovkoCo
      @BrovkoCo 7 лет назад +1

      Appreciate the response, I figured it out, I went about it a bit differently then your video, but still got the correct end result. This is what I did to fix it. Thanks again for the video. Actually helped a lot.
      public void displayDialog(){
      LayoutInflater layoutInflater = LayoutInflater.from(this);
      final View inflator = layoutInflater.inflate(R.layout.dialog_new_post, null);
      AlertDialog.Builder alert = new AlertDialog.Builder(this);
      alert.setTitle("Title");
      final EditText etNewDialogPost = (EditText) inflator.findViewById(R.id.etNewPostDialog);
      alert.setPositiveButton("ok", new DialogInterface.OnClickListener() {
      @Override
      public void onClick(DialogInterface dialogInterface, int i) {
      final String etNewPostDialog = etNewDialogPost.getText().toString().trim();
      //do something
      }
      });
      alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
      @Override
      public void onClick(DialogInterface dialogInterface, int i) {
      dialogInterface.cancel();
      }
      });
      alert.show();
      }

    • @CodingDemos
      @CodingDemos  7 лет назад

      That's great :)

  • @CapstoneDavao
    @CapstoneDavao 7 лет назад

    is this work on AIDE Android App?

    • @CodingDemos
      @CodingDemos  7 лет назад

      I'm sorry i haven't tried that out

  • @Rusellminsk
    @Rusellminsk 7 лет назад +1

    thanks
    Now I know how i can do that

  • @harshphoujdar1685
    @harshphoujdar1685 7 лет назад

    And what if we want the dialog in a fragment ?

  • @manojchowrasiya8527
    @manojchowrasiya8527 7 лет назад +1

    How we can save the text in to the file from edit text by click on yes

    • @dcastudios7185
      @dcastudios7185 7 лет назад

      You should use something called shared preferences to store the data

  • @ayeshamukhtar4855
    @ayeshamukhtar4855 7 лет назад

    i want a dialog box after clicking on icon at action bar i.e add, for this how can we initialize the icon in main activity?

    • @CodingDemos
      @CodingDemos  7 лет назад +1

      Hi, all you have to do is follow the tutorial that i did which will teach you how to create the option menu, and then you can use this alertdialog code together to show the dialog every time you click on any items in the option menus.
      Here is the video tutorial link: ruclips.net/video/EZ-sNN7UWFU/видео.html

    • @ayeshamukhtar4855
      @ayeshamukhtar4855 7 лет назад

      Thank You!

  • @mashoodkiyani3992
    @mashoodkiyani3992 7 лет назад

  • @ajaysajeev007
    @ajaysajeev007 7 лет назад +1

    How to auto close the popup after button click?

    • @techgalaxy8382
      @techgalaxy8382 7 лет назад

      Ajay Sajeev declare the Alert Dialog as a Global Variable and inside the onClickListener type the name of the global Variable and put the cancel button
      // Global Variable
      AlertDialog ad;
      ........
      onClick{
      ad.cancel
      }
      You surely need to look up at Stack overflow....Even I checked it.

  • @rajkumardey7396
    @rajkumardey7396 6 лет назад

    how to disable dialog when click the button...

  • @medoalking9062
    @medoalking9062 2 года назад

    hi mister plz when i click on button in dialog the email and pasw edit texts are not appeared. how solve it?

    • @CodingDemos
      @CodingDemos  2 года назад

      Hi, is there any error message in the logcat?

    • @medoalking9062
      @medoalking9062 2 года назад

      @@CodingDemos i not have error in logcate the app it run but when i clicked button not respons

  • @danilochagov8418
    @danilochagov8418 6 лет назад +1

    What font do you use there?

    • @CodingDemos
      @CodingDemos  6 лет назад

      Hi, may I know which part are you referring to?

    • @danilochagov8418
      @danilochagov8418 6 лет назад

      What? I asked - "What font do you use in Android Studio?"

    • @CodingDemos
      @CodingDemos  6 лет назад

      Oh i'm not using any special font, that is the default font in Android Studio. For the black theme I'm using Dracula :)

  • @cristhianbonilla8738
    @cristhianbonilla8738 7 лет назад

    how can i open another fragment when is succes ?

  • @farzanaakramfarzana8007
    @farzanaakramfarzana8007 6 лет назад +1

    great