Android_View_得到Activity
Context context = view.getContext(); if (context instanceof Activity){ Activity activity = (Activity)context; }
//应用 public View.OnClickListener onClickListener = new View.OnClickListener() { public void onClick(View v) { Activity currentActivity = (Activity) v.getContext(); Intent i = new Intent(currentActivity, ScreenTransitionLab.class); currentActivity.startActivity(i); } };
posted on 2017-08-01 13:06 gavanwanggw 阅读(109) 评论(0) 编辑 收藏 举报