카카오톡 로그인 구현도중오류

MainActivity.class 코드

package com.example.kakaologin;

import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.androidquery.AQuery;
import com.kakao.auth.ISessionCallback;
import com.kakao.auth.Session;
import com.kakao.network.ErrorResult;
import com.kakao.usermgmt.LoginButton;
import com.kakao.usermgmt.UserManagement;
import com.kakao.usermgmt.callback.LogoutResponseCallback;
import com.kakao.usermgmt.callback.MeResponseCallback;
import com.kakao.usermgmt.response.model.UserProfile;
import com.kakao.util.exception.KakaoException;
import com.kakao.util.helper.log.Logger;
import de.hdodenhof.circleimageview.CircleImageView;

public class MainActivity extends AppCompatActivity {
private SessionCallback callback;
TextView user_nickname,user_email;
CircleImageView user_img;
LinearLayout success_layout;
Button logout_btn;
LoginButton loginButton;

AQuery aQuery;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    aQuery = new AQuery(this);
    callback = new SessionCallback();
    Session.getCurrentSession().addCallback(callback);
    // 카카오톡 로그인 버튼
    loginButton = (LoginButton)findViewById(R.id.com_kakao_login);
    loginButton.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {

            if(event.getAction() == MotionEvent.ACTION_DOWN){
                if(!isConnected()){
                    Toast.makeText(MainActivity.this,"인터넷 연결을 확인해주세요",Toast.LENGTH_SHORT).show();
                }
            }

            if(isConnected()){
                return false;
            }else{
                return true;
            }
        }
    });

    // 로그인 성공 시 사용할 뷰
    success_layout = (LinearLayout)findViewById(R.id.success_layout);
    user_nickname =(TextView)findViewById(R.id.user_nickname);
    user_img =(CircleImageView) findViewById(R.id.user_img);
    user_email =(TextView)findViewById(R.id.user_email);
    logout_btn = (Button)findViewById(R.id.logout);
    logout_btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(Session.getCurrentSession().isOpened()) {
                requestLogout();
            }
        }
    });


    if(Session.getCurrentSession().isOpened()){
        requestMe();
    }else{
        success_layout.setVisibility(View.GONE);
        loginButton.setVisibility(View.VISIBLE);
    }

}


//인터넷 연결상태 확인
public boolean isConnected() {
    ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo netInfo = cm.getActiveNetworkInfo();
    if (netInfo != null && netInfo.isConnectedOrConnecting()) {
        return true;
    }

    return false;
}


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (Session.getCurrentSession().handleActivityResult(requestCode, resultCode, data)) {
        return;
    }
    super.onActivityResult(requestCode, resultCode, data);
}


private class SessionCallback implements ISessionCallback {

    @Override
    public void onSessionOpened() {
        //access token을 성공적으로 발급 받아 valid access token을 가지고 있는 상태. 일반적으로 로그인 후의 다음 activity로 이동한다.
        if(Session.getCurrentSession().isOpened()){ // 한 번더 세션을 체크해주었습니다.
            requestMe();
        }
    }

    @Override
    public void onSessionOpenFailed(KakaoException exception) {
        if(exception != null) {
            Logger.e(exception);
        }
    }
}

private void requestLogout() {
    success_layout.setVisibility(View.GONE);
    loginButton.setVisibility(View.VISIBLE);
    UserManagement.getInstance.requestMe(new LogoutResponseCallback() {
        @Override
        public void onCompleteLogout() {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(MainActivity.this, "로그아웃 성공", Toast.LENGTH_SHORT).show();
                }
            });
        }
    });
}

private void requestMe() {
    success_layout.setVisibility(View.VISIBLE);
    loginButton.setVisibility(View.GONE);

    UserManagement.getInstance.requestMe(new MeResponseCallback() {
        @Override
        public void onFailure(ErrorResult errorResult) {
            Log.e("onFailure", errorResult + "");
        }

        @Override
        public void onSessionClosed(ErrorResult errorResult) {
            Log.e("onSessionClosed",errorResult + "");
        }

        @Override
        public void onSuccess(UserProfile userProfile) {
            Log.e("onSuccess",userProfile.toString());
            user_nickname.setText(userProfile.getNickname());
            user_email.setText(userProfile.getEmail());
            aQuery.id(user_img).image(userProfile.getThumbnailImagePath()); // <- 프로필 작은 이미지 , userProfile.getProfileImagePath() <- 큰 이미지
        }

        @Override
        public void onNotSignedUp() {
            Log.e("onNotSignedUp","onNotSignedUp");
        }
    });
}

@Override
protected void onDestroy() {
    super.onDestroy();
    Session.getCurrentSession().removeCallback(callback);
}

}


private void requestLogout() {
success_layout.setVisibility(View.GONE);
loginButton.setVisibility(View.VISIBLE);
UserManagement.getInstance.requestMe(new LogoutResponseCallback() {
@Override
public void onCompleteLogout() {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(MainActivity.this, “로그아웃 성공”, Toast.LENGTH_SHORT).show();
}
});
}
});
}

부분과

private void requestMe() {
success_layout.setVisibility(View.VISIBLE);
loginButton.setVisibility(View.GONE);

    **UserManagement.getInstance.requestMe(new MeResponseCallback() {**
        @Override
        public void onFailure(ErrorResult errorResult) {
            Log.e("onFailure", errorResult + "");
        }

에서
두부분 다
error: cannot find symbol variable getInstance
오류가뜹니다…

UserManagement.requestMe 에서
UserManagement.getInstance.requestMe로 바꿔야한다고 선배개발자님의 답변을보고 바꾸어봤는데
이렇게오류가뜨는데 혹시 답변을 얻을수있을까해서 질문드립니다.

혹시 더 필요한 소스코드가 있다면 답변달아주시면 확인즉시 수정할수있도록하겟습니다!!

메소드이기 때문에 getInstance() 로 호출하셔야 해요.

1개의 좋아요

와 감사합니다 kein.Kang 님 의 답글을 보고 했었는데 답변도 받을줄은 몰랏네요 정말감사드립니다
좋은어플 만들수있도록 노력하겠습니다!!

그럼

UserManagement.getInstance.requestMe(new MeResponseCallback() 를
UserManagement.getInstance().requestMe(new MeResponseCallback() 가 맞는건가요!?