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); } };
时间: 2024-10-09 21:26:44