Calling another screen on android

Asked

Viewed 65 times

0

public static class PlaceholderFragment extends Fragment {

    public PlaceholderFragment() { }

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

        View rootView = 
                inflater.inflate(R.layout.fragment_main, container, false);

        Button btnNumberGuessGame = 
                rootView.findViewById(R.id.btnNumberGuessGame);

        btnNumberGuessGame.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = 
                        new Intent(getActivity(), NumberGuessGame.class);
                getActivity().startActivity(intent);
            }
        });
        return rootView;
    }
}

It’s not calling another screen, theoretically the code is "right".

  • I don’t see any code in the question. Please edit the question to include code.

  • I added the code there, it does not call the second screen

  • Look at this I think this is it POST

  • Any error appears in the console?

  • The Activity Numberguessgame was declared on Androidmanifest.xml?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.