@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_message); btn_back = (Button) findViewById(R.id.button_back); btn_delete_all = (Button) findViewById(R.id.button_delete_all); txt_title = (TextView) findViewById(R.id.textView_title); linearlayout_main = (LinearLayout) findViewById(R.id.linearlayout_main); txt_title.setTypeface(Global.face, Typeface.BOLD); btn_delete_all.setTypeface(Global.face, Typeface.BOLD); btn_back.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub finish(); Intent intent = new Intent(MessageActivity.this, MainActivity.class); startActivity(intent); } }); btn_delete_all.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { DeleteMyMessages deleteMsg = new DeleteMyMessages(); deleteMsg.execute(); } }); progressView = (FrameLayout) findViewById(R.id.progressView); disableButtons(); GetMyMessages myMessages = new GetMyMessages(); myMessages.execute(); }
@Override protected void onPostExecute(String result) { progressView.setVisibility(View.INVISIBLE); enableButtons(); JSONObject reader; try { reader = new JSONObject(result); String errCode = reader.getString(Global.ERROR_CODE); if (errCode.equals("0")) { GetMyMessages myMessages = new GetMyMessages(); myMessages.execute(); } else { Toast.makeText( getApplicationContext(), reader.getString(Global.ERROR_MSG), Toast.LENGTH_LONG) .show(); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } }