重写返回键(intent 带返回值的)
通过返回键往上个活动里传值
@Override public void onBackPressed() { Intent intent = new Intent(); intent.putExtra("data_return","HelloFirstActivity"); setResult(RESULT_OK,intent); Toast.makeText(this,"你点击了返回键",Toast.LENGTH_SHORT).show(); finish(); }