Android- java : querying in parse database

六月ゝ 毕业季﹏ 提交于 2019-12-08 13:26:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!