By clicking on the "Add Client" button that is seen in the first photo, it generates a dialog (of a layout) where I will enter data.
I'm doing the tests to capture that data with a Toast but it returns it as null: "Added clientenull" (I'm testing only with the Last Name field, I still do not validate).
Debugging I stumbled upon this error:
"SPAN_EXCLUSIVE_EXCLUSIVE spans can not have a zero length"
I found the possible solution that was adding this property to EditText: android: inputType="textNoSuggestions"
However, I'm still throwing the same error.
This is my portion of the code.
public class Clientes extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_clientes,container,false);
Button btnAddClient = (Button)view.findViewById(R.id.btnAddClient);
EditText txtDNI = (EditText)view.findViewById(R.id.txtDNI);
EditText txtRUC = (EditText)view.findViewById(R.id.txtRUC);
final EditText txtApellidos = (EditText)view.findViewById(R.id.txtApellidos);
EditText txtNombres = (EditText)view.findViewById(R.id.txtNombres);
EditText txtDireccion = (EditText)view.findViewById(R.id.txtDireccion);
btnAddClient.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
builder.setTitle("Agregar Cliente");
builder.setView(R.layout.dialog_clientes);
builder.setPositiveButton("Agregar", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getActivity(), "Agregado cliente" + txtApellidos, Toast.LENGTH_SHORT).show();
}
});
builder.show();
builder.create();
}
});
return view;
}
}