My application uses login with twitter, the example code works using Activity but I want my app to work using Fragment like this:
How to edit error on Uri uri = getIntent().getData();
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_feed, container, false);
Uri uri = getIntent().getData(); // <<<<<<<
String verifier = uri.getQueryParameter(ConstantValues.URL_PARAMETER_TWITTER_OAUTH_VERIFIER);
TwitterGet get=new TwitterGet();
get.execute(verifier);
return rootView;
}
Use Uri uri = getIntent().getData();
in the fragment, you just need call getActivity() first:
Uri uri = getActivity().getIntent().getData();