问题
In my app I use parse database.
I want to invite people for a meeting ,but I want to remove invite button from current user.
I'm using if condition to do that but it is not working.
I'm querying a column in parse database, the column name is "sender"
Parse Database Table name is Meeting
below is my if condition . i want to get current user somehow to put inside if condition . if anyone knows help me ?
the function I expect is if current user is equal to sender , invite button should be invisible
if( "sender" == thisPerson.getObjectId()) {
buttonLayout.setVisibility(View.INVISIBLE);
inviteMessage.setVisibility(View.INVISIBLE);
messageLayout.setVisibility(View.VISIBLE);
inviteMessage.setText("you can invite other people for meeting");
}else{
code.....
}
回答1:
this is the answer for my question.
if(canRequest){
if(noRequest){
setButton(false);
if(ParseUser.getCurrentUser().getObjectId().equals("_User")){
messageLayout.setVisibility(View.INVISIBLE);
}else{
messageLayout.setVisibility(View.VISIBLE);
}
buttonLayout.setVisibility(View.VISIBLE);
inviteMessage.setVisibility(View.VISIBLE);
if(ParseUser.getCurrentUser().getObjectId().equals(objectId)){
messageLayout.setVisibility(View.INVISIBLE);
} else {
if(parseUser.getObjectId().equals(thisPerson)){
messageLayout.setVisibility(View.INVISIBLE);
}else{
messageLayout.setVisibility(View.VISIBLE);
inviteMessage.setText("Do you want to invite this person for a meeting?");
}
}
}else{
if(myInvite){
setButton(true);
inviteMessage.setVisibility(View.VISIBLE);
messageLayout.setVisibility(View.VISIBLE);
if(meetingStatus.equals("ACCEPTED")){
buttonLayout.setVisibility(View.INVISIBLE);
inviteMessage.setText("You request has been accepted, be ready fo the meeting.");
}else{
buttonLayout.setVisibility(View.VISIBLE);
inviteMessage.setText("You have already requested a meeting with this attendee and it's waiting for approval.");
}
}else{
inviteMessage.setVisibility(View.VISIBLE);
messageLayout.setVisibility(View.VISIBLE);
buttonLayout.setVisibility(View.VISIBLE);
if(meetingStatus.equals("ACCEPTED")){
setButton(false);
buttonLayout.setVisibility(View.INVISIBLE);
inviteMessage.setText("You have already accepted the meeting request.");
}else{
if(ParseUser.getCurrentUser().getObjectId().equals(objectId)){
inviteMessage.setVisibility(View.INVISIBLE);
}
else{setButton(false);
inviteMessage.setText("You have been requested for a meeting. Do you wish to accept it?");
}
}
}
}
}else{
buttonLayout.setVisibility(View.INVISIBLE);
inviteMessage.setVisibility(View.VISIBLE);
messageLayout.setVisibility(View.VISIBLE);
inviteMessage.setText("Sorry, you cannot respond to this event. This event has already passed.");
}
来源:https://stackoverflow.com/questions/43208077/android-java-querying-in-parse-database