Skip to main content

Add Edittext Inside Dialog Box

Add Edittext Inside Dialog Box






If you haven`t yet watched the video...Watch it right now!!!



The code used in the above video is available here.

final EditText edittext1= new EditText(MainActivity.this);
LinearLayout.LayoutParams lpar = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
edittext1.setLayoutParams(lpar);
dialog.setView(edittext1);








textview1.setText(edittext1.getText());







Comments

  1. It shows error... For line :
    dialog.setView(edittext1);

    And the erorrs says that dialog cannot be resolved.

    ReplyDelete
    Replies
    1. This happens because you forgot to create a dialog component Whit the same name of the one called in code as above!

      Delete
    2. One more thing you should remember is that you should create a textview and me it as the one is going to receive the parameter

      Delete
    3. You should create a dialogue companent named 'dialog' to work this code.

      Delete
  2. Change dilog name with your dialog name
    Like
    dialog1.setView

    ReplyDelete
  3. How to do that when you enter one text was displayed another?

    ReplyDelete
  4. Please I want to add two edit text in the dialog in sketchware

    ReplyDelete
    Replies
    1. Use (new) LinearLayout instead, create 2 (new) EditText then use AddChild.

      Delete
  5. Use .toString() like edittext1.getText().toString();

    ReplyDelete

Post a Comment

Did you like this tutorial ?

Popular posts from this blog

Create Custom Popup Window using Sketchware

Create Custom Popup Window using Sketchware Refer the video below if  you get stuck.  1) Add a custom view named window.You can name it according to your wish.  2)Design your popup window.  2) Now, In the logic section,In OnCLick event of button.Add the following  code Create a view View popupView = getLayoutInflater().inflate(R.layout.window, null); Popup window  final PopupWindow popup = new PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true); Initialize  Button b1 = popupView.findViewById(R.id.button1); Button b2 = popupView.findViewById(R.id.button2); OnClickListeners b1.setOnClickListener(new OnClickListener() { public void onClick(View view) { //below code will dismiss the popup window popup.dismiss(); } }); b2.setOnClickListener(new OnClickListener() { public void onClick(View view) { popup.dismiss(); } }); Show the...

Enable Downloads In Your Web Browser

Enable Downloads In Your WebBrowser Latest Tutorial..! 1) Create a new Web Browser   project in Sketchware      Below are some tutorials regarding this topic.      Please watch these tutorials . These tutorials will help you in understanding the topic. Part 1 Part 2 Part 3 3) Export the project which you have created in Sketchware to AIDE or Android Studio 4) Navigate to AndroidManifest.xml and add the following permission <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 5) Now Open MainActivity.java or the Java File where you want to add the Download Listener      and add the following code         webview1.setDownloadListener(new DownloadListener() {                       @Override          ...