Null Validation on EditText box in Alert Dialog - Android

后端 未结 6 1346
有刺的猬
有刺的猬 2021-01-02 23:15

I am trying to add some text validation to an edit text field located within an alert dialog box. It prompts a user to enter in a name.

I want to add some validatio

6条回答
  •  日久生厌
    2021-01-03 00:04

    //if view is not instantiated,it always returns null for edittext values.

    View v = inflater.inflate(R.layout.new_location_dialog, null);
    builder.setView(v); 
    
    
    
    final EditText titleBox = (EditText)v.findViewById(R.id.title);
    final EditText descriptionBox = (EditText)v.findViewById(R.id.description); 
    

提交回复
热议问题