如何与cookie android交互?

如何与cookie android交互?,android,Android,我正在使用webview(“http://m.platt.com/Login.aspx“”,其中包含三个文本字段,如acc num、username和password。现在我需要与Cookie交互,这意味着我需要存储这些文本字段。之后,我需要发布该url,然后它将显示为登录状态。我不知道如何做。请帮我一下?对不起,我的英语不好。 我的源代码如下: private boolean login(String loginurl){ String _URL = loginurl;

我正在使用webview(“http://m.platt.com/Login.aspx“”,其中包含三个文本字段,如acc num、username和password。现在我需要与Cookie交互,这意味着我需要存储这些文本字段。之后,我需要发布该url,然后它将显示为登录状态。我不知道如何做。请帮我一下?对不起,我的英语不好。 我的源代码如下:

private boolean login(String loginurl){
        String _URL = loginurl;
        String BOUNDARY = "----------------------------tjays";

        Log.v("send reply url",""+loginurl);
        // "----MultiPartBoundary";

        try {
            URL url = new URL(_URL);
            HttpURLConnection conn = (HttpURLConnection) url
                    .openConnection();
            conn.setDoInput(true);
            conn.setDoOutput(true);
            conn.setUseCaches(false);
            conn.setRequestProperty("Connection", "Keep-Alive");

            conn.setRequestMethod("POST");
            conn.setRequestProperty("Content-Type",
                    "multipart/form-data;boundary=" + BOUNDARY);
            conn.connect();


            DataOutputStream dos = new DataOutputStream(
                    conn.getOutputStream());
            dos.writeBytes("\r\n--"
                    + BOUNDARY
                    + "\r\nContent-Disposition: form-data; name=\"body\";\r\n\r\n"
                    + mEditAccountNumber.getText().toString()+mEdit_userName.getText().toString()+mEdit_password.getText().toString());
            dos.writeBytes("\r\n--" + BOUNDARY + "\r\n");
            dos.flush();
            dos.close();

            // Ensure we got the HTTP 200 response code
             responseCode = conn.getResponseCode();
            if(responseCode == 200){
                responseCode_logout=0;
            Log.v("response url ", "----------->"+dos.toString()+""+dos.size());
            sign_in.setText("Sign Out"); 
            Toast.makeText(Settings.this,"Logined ",Toast.LENGTH_SHORT).show();
            sign_out = true;

            }
            if (responseCode != 200) {
                sign_out = false;
                throw new Exception(String.format(
                        "Received the response code %d from the URL %s",
                        responseCode, url));
            }

            conn.disconnect();

        } catch (Exception e) {
            // Logger.getAnonymousLogger().severe(e.getMessage());
            return false;
        }

        return true;
    }