1
我有一個有自定義視圖的活動。我怎樣才能從視圖完成活動
我要補充活動結果:
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();
感謝的最佳選擇。它給了我我想要的。可能是一些複雜的,但它的作品。 – Vyacheslav