Android-How to reload fragments and activities

For reloading shards

// Reload present fragment
Fragment frg = null;
frg = getSupportFragmentManager().findFragmentByTag("Your_Fragment_TAG");
last FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.detach(frg);
ft.connect(frg);
ft.commit();

Your_Fragment_TAG is the identify you gave your fragment if you created it

This code is for the assist library.

If it would not assist older units, simply use getFragmentManager as an alternative of getSupportFragmentManager

For exercise recharge

Intent i = new Intent(MainActivity.this, MainActivity.class);
end();
overridePendingTransition(0, 0);
startActivity(i);
overridePendingTransition(0, 0);

Within the above code, we have now used overridePendingTransition(), it’s used to take away the exercise creation animation whereas the exercise is being recreated.

By admin

x
THE FUTURE - BENEFIT NEWS - DANA TECH - RALPH TECH - Tech News - BRING THE TECH - Tech Updates - News Update Viral - THE TRUTH - WORLD TODAY - WORLD UPDATES - NEWS UPDATES - NEWS FLASH - TRUTH NEWS - RANK NEWS - PREMIUM NEWS - FORUM NEWS - PROJECT NEWS - POST NEWS - WORLD NEWS - SPORT NEWS - INDICATOR NEWS - NEWS ROOM - HEADLINE NEWS - NEWS PLAZA