Answers for "how to use getactivity to go to next activity"

1

how to open an activity from a fragment

Button btn1 = (Button) thisLayout
            .findViewById(R.id.btnDb1);

    btn1.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(getActivity(), otherActivity.class);
            ((MainActivity) getActivity()).startActivity(intent);

        }
    });

    return thisLayout;
}
Posted by: Guest on May-27-2020

Code answers related to "how to use getactivity to go to next activity"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language