[FIXED] i'm getting this error can someone help me out **illegal start of expression

Issue

I’m using the fragment but getting this error illegal start of expression?

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
      View view = return inflater.inflate(R.layout.fragment_frag1, container, false);
      return view;
    }
}

Solution

Your are using multiple returns which is causing the issue.
try to use like:

 @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
  View view = inflater.inflate(R.layout.fragment_frag1, container, false);
  return view;
}

instead of what currently you are trying.

Answered By – Mr. Mad

Answer Checked By – Terry (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published