Code to fix the docuble click or double tap issue,in android

Issue : whenever user clicks many times in a button/list to show any screen,it shows multiple(duplicate) screens,based on the button clicks of User.   

I faced this issue many times.I fixed this issue by following either of two cases:

1)
using      setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);  to intent like this: 
 
Intent i=new Intent(JobsListScreen.this,JobDetailsScreen.class);                   
                    i.putExtras(b);
                    i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    startActivity(i);


(OR)


2)  use android:launchMode="singleTop" this property in Manifest file like this:

<activity
            android:name=".pl.Mobile.HomeScreen"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="portrait"
            android:launchMode="singleTop"
            android:theme="@android:style/Theme.NoTitleBar"
            android:windowSoftInputMode="adjustPan" >

for more information please follow the Below link:
http://developer.android.com/guide/topics/manifest/activity-element.html#lmode

Comments

Post a Comment

Popular posts from this blog

Custom Dialog with no title and full screen in Android

Best working code to set Date limits on Date Picker Dialog,in Android

code to display .pdf,.text,.DOC,.DOCX,.doc extension files exists in SDCard