how to open an activity from a fragment

Solutions on MaxInterview for how to open an activity from a fragment by the best coders in the world

showing results for - "how to open an activity from a fragment"
Aldo
18 Jan 2018
1Button btn1 = (Button) thisLayout
2            .findViewById(R.id.btnDb1);
3
4    btn1.setOnClickListener(new OnClickListener() {
5
6        @Override
7        public void onClick(View v) {
8            // TODO Auto-generated method stub
9            Intent intent = new Intent(getActivity(), otherActivity.class);
10            ((MainActivity) getActivity()).startActivity(intent);
11
12        }
13    });
14
15    return thisLayout;
16}
queries leading to this page
intent from class to fragmentopen fragment in activitylaunch activity from fragment java androidhow to open fragment from activity how to create intent from fragmentopen fragment from activity in android android opens a new activity in fragmentput an activity in fragmenthow to use getactivity to go to next activity in fragmentandroid studio go to activity from fragmentopen fragment from activity androidhow to open a fragment when start a activity in androidcall fragment method from activityopen activity from fragment with onclickhow to open a activity from a fragmentopen an activity from fragmentopen fragment from fragmentfragment lifecycle android having an intenthow to use getactivity to go to next activityopen an activity from a fragment androidcan an fragment open a new activityandroid how to open fragment from activity in javastart activity from fragmentstart activity fragment androidintent inside fragmentintent open fragmentopen new activity from fragmentandroid cant find fragmentandroid open new activity from fragmentandroid java start activity from fragmentfrom fragment start new activityopen fragment in activity androidhow to open a fragment from activityhow to start new activity from fragmentopen fragment from activitystart an activity from fragmentstart activity in fragment androidopen new activity from fragment androidandroid open fragment from activitycall function from fragment to activitychange activity from fragmentopeneing fragment as intentopen fragment from an itemstartactivity fragmenthow to open activity from fragmentopen another activity from fragmentopen fragment from main activityfragment open activityopen fragment in activity kotlinopen activity from fragmenthow to call an fragment in oncreate method in androidhow to launch activity in fragmentload activity in fragment androidopen activity from fragment androidlaunch activity from fragmentopen activity from fragment javaopen an activity from a fragmentandroid start activity from fragmenthow to open an activity from a fragmenthow to switch activities to a frag in android studiocase fragmentactivity to activity androidadding fragments to activity androidfragment startactivity intentopen a fragment from activity android javastartactivity from fragment androidstart activty fragenthow to open a fragment inside a fragmenthow to start activity in fragment in javaactivity open fragmentgo to another activity from fragmentreturn activity inside fragment androidhow to open fragment from activity in androidhow to open new fragment in androidhow to open a fragment from an activityopen fragment from activity not workingandroid start new activity from fragmentandroid fragmenthow to open an activity from a fragment