private void showChangeTagDialog ( ) { View view = getLayoutInflater ( ) . inflate ( R . layout . dialog_change_tag , null , false ) ; final EditText tagEditText = ( EditText ) view . findViewById ( R . id . tag ) ; tagEditText . setText ( tagView . getText ( ) ) ; new AlertDialog . Builder ( this ) . setTitle ( R . string . change_tag ) . setView ( view ) . setNegativeButton ( android . R . string . cancel , null ) . setPositiveButton ( android . R . string . ok , new DialogInterface . OnClickListener ( ) { @ Override public void onClick ( DialogInterface dialog , int which ) { String tag = tagEditText . getText ( ) . toString ( ) . trim ( ) ; if ( ! tag . isEmpty ( ) ) { tagView . setText ( tag ) ; } } } ) . show ( ) ; }
Show a dialog for user to change the tag empty text is not allowed .