Android 台灣中文網

標題: 如何讓app紀錄帳密自動登入? [打印本頁]

作者: glps367    時間: 2014-5-16 10:22
標題: 如何讓app紀錄帳密自動登入?
HttpClient client = new DefaultHttpClient();            
            HttpPost post = new HttpPost("Http://127.0.0.1/test.php");
            
            StringBody userId = new StringBody("root");
            StringBody passwd = new StringBody("1234");
            MultipartEntity entity = new MultipartEntity();
            entity.addPart("user", userId); // (Request變數,value)
            entity.addPart("passwd", passwd);

            
            post.setEntity(entity);
                HttpResponse response = client.execute(post); //送出
                HttpEntity res_entity = response.getEntity();
                InputStream in = res_entity.getContent(); //取出 回傳值
                int temp;
                while ( (temp = in.read()) !=-1){
                        info.append("" + (char)temp);
                }
               
                in.close();
目前 可以用以上方法達成登入,
可是請問有什麼方法,可以讓app紀錄帳密,以便利下次開啟時,能直接自動登入?
現在帳密是寫死的,之後將改成由使用者輸入第一次帳密後,自動記錄並且之後開啟app都能直接登入。
請問這樣有什麼方法可以達到嗎??
謝謝指導~


作者: CarolHsieh    時間: 2014-5-20 10:56
寫入 Sqlite ?




歡迎光臨 Android 台灣中文網 (https://apk.tw/) Powered by Discuz! X3.1