@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
String OutputData = "";
String UserName="";
JSONObject jsonResponse;
try {
jsonResponse = new JSONObject(result);
JSONArray jsonMainNode = jsonResponse.optJSONArray("clsStatus");
int FlgStatus = 0;
int FlgState = 0;
int ColorCode = 0;
String Message ="";
String Card1="";
String Card2="";
String Card3="";
String EmpNo="";
String EmpName="";
int lengthJsonArr = jsonMainNode.length();
for(int i=0; i < lengthJsonArr; i++)
{
JSONObject jsonChildNode = jsonMainNode.getJSONObject(i);
FlgState= Integer.parseInt( jsonChildNode.optString("FlgState").toString());
FlgStatus = Integer.parseInt( jsonChildNode.optString("FlgStatus").toString());
ColorCode = Integer.parseInt( jsonChildNode.optString("ColorCode").toString());
Message = jsonChildNode.optString("Message").toString();
UserName = jsonChildNode.optString("UserName").toString();
if (FlgState==1)
{
EmpNo = jsonChildNode.optString("EmpNo").toString();
Card1 = jsonChildNode.optString("CardNo1").toString();
Card2 = jsonChildNode.optString("CardNo2").toString();
Card3 = jsonChildNode.optString("CardNo3").toString();
EmpName = UserName;
SaveEmpDetailInDevice(Card1, Card2, Card3, EmpNo, EmpName);
}
}
EditText txtCardNo=(EditText)findViewById(R.id.edittxtCardNo);
if (FlgStatus==-1)
{
lblMessage=(TextView)findViewById(R.id.lblmsg);
lblMessage.setText(Message);
txtCardNo.setText("");
Refreshtextbox_timer();
}
if (FlgStatus==1)
{
lblMessage=(TextView)findViewById(R.id.lblmsg);
lblMessage.setText(Message);
txtCardNo.setText("");
Refreshtextbox_timer();
TextView toastMessage = (TextView) toast.getView().findViewById(android.R.id.message);
toastMessage.setTextColor(Color.BLACK);
toastMessage.setBackgroundColor(Color.RED);
toastMessage.setTextSize(25);
toast.show();
}
if (FlgStatus==2)
{
lblMessage=(TextView)findViewById(R.id.lblmsg);
lblMessage.setText(Message);
}
if (ColorCode==1)
{
lblMessage=(TextView)findViewById(R.id.lblmsg);
lblMessage.setBackgroundColor(Color.WHITE);
lblMessage.setTextColor(Color.BLACK);
}
if (ColorCode==2)
{
lblMessage=(TextView)findViewById(R.id.lblmsg);
lblMessage.setBackgroundColor(Color.RED);
lblMessage.setTextColor(Color.YELLOW);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}