Ad
AlertDialog Not Closing When Inforamtion Is Saved
My previous question is solved, but now I have another one.
My If condition not working properly
Scenario: 1. If user has not filled up his Name, then Alert Dialog is displayed 2. If user has filled up his Name, then Alert Dialog should NOT displayed
In my case, I will get Alert Dialog in any case, it does not care if Name is filled or not.
ArtistProfileView.Java
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.activity_artist_profile_view, container, false);
prefrence = SharedPrefrence.getInstance(getActivity());
userDTO = prefrence.getParentUser(Consts.USER_DTO);
paramsRate.put(Consts.ARTIST_ID, userDTO.getUser_id());
parms.put(Consts.ARTIST_ID, userDTO.getUser_id());
parms.put(Consts.USER_ID, userDTO.getUser_id());
baseActivity.headerNameTV.setText(getResources().getString(R.string.my_profile));
if(artistDetailsDTO.getName().isEmpty()) {
new AlertDialog.Builder(getActivity())
.setView(getLayoutInflater().inflate(R.layout.test5, null))
.setPositiveButton(R.string.okaypopup22,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
my_tag = 1;
dialogPersonalProfile();
}
})
.show();
}
setUiAction(view);
return view;
}
In the same Class, method which calls profile editing
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.ivEditPersonal:
my_tag = 1;
dialogPersonalProfile();
break;
case R.id.ivEditAbout:
my_tag = 2;
dialogAbout();
break;
case R.id.ivEditQualification:
dialogQualification();
break;
case R.id.ivEditSkils:
my_tag = 3;
dialogSkills();
break;
case R.id.ivEditProduct:
dialogProduct();
break;
case R.id.ivEditGallery:
dialogGallery();
break;
}
}
Ad
Answer
At first I misunderstood your question, so I have edited it.
I guess you should try adding equals()
method in if condition
if(artistDetailsDTO.getName().toString.equals(""))
Ad
source: stackoverflow.com
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
Ad