Answers for "how to open an activity from another activity in android"

10

how to open activity in android studio

Intent intent = new Intent(this, DisplayMessageActivity.class);
        intent.putExtra(key:,value:);
        startActivity(intent);
Posted by: Guest on May-19-2020
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 open an activity from another activity in android"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language