The Green Foxx The Green Foxx - 1 year ago 114
Android Question

How to initialize an Intent in a fragment class

Im trying to put up this code in my fragment class :

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
Intent haha = new Intent(ProfileFragment.this, Portal.class);

but it just keep saying that "the constructor Intent(ProfileFragment, Class) is Undefined".
i am pretty sure that i have this Class Portal in my java classes.

Answer Source

Initialize ike this..

Intent haha = new Intent(getActivity(), Portal.class)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download