How to call startactivity or call intent from onitemclick event of listview in fragment?
<p>I have a fragment that has its own layout. In the layout, there is a listview and i attached onitemclick listener that will start/open an intent when the list row is clicked. Unfortunately, I always get this error : </p>

<p><strong>Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag</strong></p>

<p>But I do not prefer to set the flag activity. I could not open the SamplePage.class</p>

<pre><code>public class FrontPageFragment extends Fragment
{

    private ArrayList&lt;Order&gt; m_orders = null;
    private OrderAdapter m_adapter;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View fragmentView=inflater.inflate(R.layout.frontpage, container, false);

        m_orders = new ArrayList&lt;Order&gt;();
        this.m_adapter = new OrderAdapter(this.getActivity().getApplicationContext(), R.layout.name, m_orders);

        View eView=(View)fragmentView.findViewById(R.id.approvedOrders);
        ListView listView=(ListView)eView.findViewById(R.id.listview);

         listView.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                int position, long id) {

                Intent intent = new Intent(view.getContext(), SamplePage.class);
                intent.putExtra("id", "1");
                view.getContext().startActivity(intent);

            }
         });

        //bind data
        listView.setAdapter(this.m_adapter);


        return fragmentView;

    }
</code></pre>
