android fragment 之间的跳转

子fragment  :

Intent intent = new Intent();

intent.setClass(WeightFragment.this.getActivity(),
HealthScore.class);
intent.putExtra("back", true);

WeightFragment.this.getActivity().startActivityForResult(intent,100);


fragment activity  :

@Override  
    protected void onActivityResult(int requestCode, int resultCode, Intent data){  
        
        if(20==resultCode){  
        Log.v("","ddddd_result");
        scorefragment.refresh();
advicefragment.refresh();
        }  
        super.onActivityResult(requestCode, resultCode, data);  
    }  


要跳转的activity  :

backable=getIntent().getBooleanExtra("back",false);

if(backable){
Log.v("","ddddd_result0");
HealthScore.this.setResult(20);
}


结束。

你可能感兴趣的:(android应用层基础)