If i click fast to my button in my Android app, it seems that code behind it runs twice. If i click my menu button twice the activity that has to be launch onclick just star
Well, that's the expected behaviour...
Launch your new acvitity with SINGLE_TOP flag
Or try setting android:launchMode="singleInstance"
for Top20 activity in your AndroidManifest.xml
Use frozen
variable inside Application
class.
That is
public class App extends Application {
public static boolean frozen = false;
}
somewhere while click:
//...
onClick() {
if (frozen) {
return;
}
frozen = true
}
//...
Somewhere to release, for instance, when new Activity has been launched
onCreate (...) {
super.onCreate(...);
frozen = false;
}
in AndroidManifest.xml
:
<application
android:allowBackup="true"
android:largeHeap="true"
android:name="com.example.App"
android:icon="@drawable/icon"
android:label="@string/app_alias"
android:theme="@style/AppTheme" >