Android_View_得到Activity

【Android_View_得到Activity】笛里谁知壮士心,沙头空照征人骨。这篇文章主要讲述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); } };




    推荐阅读