Skip to content

Commit

Permalink
can analyze json data
Browse files Browse the repository at this point in the history
  • Loading branch information
yuichi10 committed Aug 30, 2015
1 parent 7469405 commit 001f424
Showing 1 changed file with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import android.widget.Button;
import android.widget.EditText;

import org.json.JSONObject;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

Expand All @@ -20,6 +22,16 @@ public class SignIn extends ActionBarActivity implements View.OnClickListener{
//the path of this application
static String packageName = "pmv02.ppr.yuichi10.github.com.joinevents";

//data for json analyze
static String errPasskey = "ErrPass";
static String errIdkey = "ErrId";
static String sessionKey = "SessionId";

//data responses
String errPassword = "";
String errId = "";
String mSessionID = "";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -73,7 +85,9 @@ public void onClick(View v) {
HttpCommunication hc = new HttpCommunication(server, path);
hc.setPostParameter("Id", strID);
hc.setPostParameter("Password", strPass);
hc.Post();
String response = hc.Post();
analyseJson(response);

//if the password and ID was collect, go to Home activity
intent.setClassName(packageName, packageName + ".Home");
startActivity(intent);
Expand All @@ -87,6 +101,21 @@ public void onClick(View v) {
}
}

public void analyseJson(String jStr){
try {
JSONObject json = new JSONObject(jStr);
this.errPassword = json.getString(errPasskey);
this.errId = json.getString(errIdkey);
this.mSessionID = json.getString(sessionKey);
Log.d("aaa",errPassword);
Log.d("aaa",errId);
Log.d("aaa",mSessionID);
}catch (Exception e){

}

}


//MD5
public String encodePassdigiest(String password){
Expand Down

0 comments on commit 001f424

Please sign in to comment.