I have one fragment
with ListView
at left side of Screen...
whenever user clicks on any item of ListView
i show fragment
at right side ..
Below is how I am using transaction:
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
SiteDetailsFragmentActivity fragment = new SiteDetailsFragmentActivity();
fragment.setArguments(args);
fragmentTransaction.replace(R.id.fragment1, fragment);
fragmentTransaction.commit();
Why ds transaction is slow?
There are some tips may be useful.
if you have lots of work like network calls in your fragment try to call them after your onCreateView() function. i.e you can use onStart() or onResume() functions.Also, try to use multiThread.
if you have Image Loading try to reduce image qualities or its size.reduce image size
Also avoid animation in replacing your fragments.
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With