1. 程式人生 > >如何從非Activity跳轉到Activity

如何從非Activity跳轉到Activity

1. 如果你是在click事件裡面跳轉的話,可以使用下面的方法:

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);
    }
};