Httpclient를 한번 생성하고 다른 class에서도 가져다 쓰면 쿠키가 계속 유지된다.

Cookie_class.getInstance().setclient(httpClient);

httpClient = Cookie_class.getInstance().getclient();

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public class Cookie_class {
    private static Cookie_St instance = null;
    private HttpClient httpclient;
    public HttpClient getclient(){
        return httpclient;
    }
    public void setclient(HttpClient a){
        httpclient = a;
    }
    public static synchronized Cookie_St getInstance(){
        if(null == instance){
            instance = new Cookie_St();
        }
        return instance;
    }
}
cs


'Android' 카테고리의 다른 글

Kakao link를 사용해보자 -세팅  (0) 2015.11.12

카카오 링크를 처음 사용해보았다.

우선 https://developers.kakao.com/ 이곳에서

앱만들기를 클릭해서 자기가 원하는 앱 이름을 입력하고 생성한다.


생성한 앱에 들어가서 플랫폼 추가를 누른다


패키지 명을 입력하고 추가

키 해시에는 

를 cmd(terminal)에서 실행한 결과를 입력하면 된다.


이제 Android Studio로 돌아와서 

순서대로 

첫번째 파일에는 

두번째 파일에는 dependencies{  안에

를 추가해준다.

string.xml에는


<string name="kakao_app_key">카카오에서발급받은키값</string>

manifest에는


<meta-data
android:name="com.kakao.sdk.AppKey"
android:value="@string/kakao_app_key" />

를 추가해준다

이제 사용할 준비를 끝냈다.

카카오톡 링크를 사용하는 방법은

https://developers.kakao.com/docs/android#카카오링크

를 보면 된다.

'Android' 카테고리의 다른 글

android apache http 쿠키  (0) 2016.02.23

+ Recent posts