Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use ShowCaseView v5 builder with fragments?

I found examples for the legacy version, but not for the new builder pattern. Does anyone know how to do this?

like image 740
Michael Litvin Avatar asked May 22 '14 11:05

Michael Litvin


1 Answers

The Builder constructor only needs an activity public Builder(Activity activity) so:

public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment, container, false);
    showcaseView = new ShowcaseView.Builder(getActivity())
            .setTarget(new ViewTarget(view.findViewById(R.id.textView)))
            .setOnClickListener(listener)
            .build();
    ....
like image 148
Stephan Avatar answered Sep 29 '22 07:09

Stephan