Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refresh Current Activity without Delay

I am new to android development.So I want to refresh the current activity when Radio button clicked.When I clicked the radio button I want to change the language and refresh the current Activity without any delay.Now I click the button the current layout gone and open new one.But it takes some time.Anyone can see there is new layout coming. This is my code

Intent intent = getIntent();
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
finish();
startActivity(intent);
like image 926
YouKnowbetter Avatar asked Aug 06 '13 12:08

YouKnowbetter


2 Answers

You can try this:

Intent intent = getIntent();
overridePendingTransition(0, 0);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
finish();
overridePendingTransition(0, 0);
startActivity(intent);

this reload's your activity without animation.

like image 102
AllenC Avatar answered Nov 08 '22 21:11

AllenC


This code may work

Intent intent = getIntent();
finish();
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);
like image 1
Muralikrishna G S Avatar answered Nov 08 '22 20:11

Muralikrishna G S