我们如何从片段中启动Activity

时间:2017-03-27 08:14:38

标签: java android

seOnClickListener

我希望使用 <div class="container"> <div class="row"> <div class="col-md-4 col-md-offset-4"> <div class="thumbnail"> <a href="http://i1126.photobucket.com/albums/l611/ldocherty1/IMG_0730_zpsiz4dqc47.jpg" target="_blank"> <img src="http://i1126.photobucket.com/albums/l611/ldocherty1/IMG_0730_zpsiz4dqc47.jpg" alt="picture" class="img-responsive center-block" /> </a> </div> </div> 从片段转到the president of 上面的代码不起作用

4 个答案:

答案 0 :(得分:3)

您应该使用:

Promise.all()

答案 1 :(得分:0)

Intent i = new Intent(FragmentName.this.getActivity(), ActivityTwo.class);
FragmentName.this.startActivity(i);

答案 2 :(得分:-1)

Intent i = new Intent(getActivity(), ActivityTwo.class);
 getActivity.startActivity(i);

答案 3 :(得分:-1)

In your fragment write below code.

private Activity mActivity;

@Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mActivity = (Activity) context;
    }

and then call your activity

Intent intent = new Intent(mActivity, ActivityTwo.class);
mActivity.startActivity(intent);

this will work for you.