Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
How am I supposed to go to any fragment from an activity?

This is the activity code. I'm tryin to go to the fragment when I click on a button. But I don't know how to do it. And when I use intent like the intent report, it asked me to declare the shopping_cart (fragment) at manifest.

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
    switch (item.getItemId()) {
        case (R.id.shopping_cart):
            

        case (R.id.report):
            Intent report;
            report = new Intent(getApplicationContext(), Report.class);
            startActivity(report);
            break;
    }

    return super.onOptionsItemSelected(item);
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Just Do This For Going Activity To Fragment

 public void replace(Fragment fragment) {
        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.frame, fragment);
        fragmentTransaction.addToBackStack(fragment.toString());
        fragmentTransaction.commit();
    }

And In Button Click Just Put Below Code

replace(new FragmentName());
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!