我有一个具有自定义视图的活动。
我必须添加活动结果:
public class ActView extends Activity implements OnClickListener {
<...code...>
@Override
protected void onCreate(Bundle savedInstanceState) {
<...code...>
layout = (LinearLayout) findViewById(R.id.chart_container);
timelineview = new VDrawTimeLine(this,contentFull);
timelineview.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
timelineview.setBackgroundColor(0xffffffff);
timelineview.setVisibility(View.VISIBLE);
layout.addView(timelineview);
<...code...>
}
}
查看类:
public class VDrawTimeLine extends View implements OnTouchListener{
<...code...>
public VDrawTimeLine(Context context, ArrayList<_MainData> contentFull) {
super(context);
this.con = context;
this.content = contentFull;
<...code...>
}
}
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
finishFunction();//I need here finish event this activity result for ActView Activity.
return true;
}
finishFunction - 我必须在这里写什么来完成带有父活动结果的 ActView?
我需要这样的东西:
Intent intent = new Intent();
intent.putExtra(dataname, value);
setResult(RESULT_OK,intent);
finish();