A way to prevent multiple instances of the same intent on button click in Android application
Sometimes while pressing a button repeatedly causes multiple instance of the same intent in android applications. To resolve this issue use intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) where you are creating the intent in your application, before starting the activity. Like below —
Intent intent = new Intent(this, YourClas.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivityForResult(intent, INTENT_ID);
AdWhirl integration in Android using xml layout
Integrating AdWhirl advertising is badly documented on AdWhirl support website. So, I have decided to share my experience here……
You can integrate AdWhirl very easily in your Android application as a provider following the steps below……
1. Register an account at AdWhirl
2. Add your application and the associated settings on the website
3. Download the AdWhirl sdk from the link
4. Add the sdk jar to your project build path
5. Add these parmissions to the menifest file
<uses-permission android:name=”android.permission.INTERNET” />
<uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE” />
<uses-permission android:name=”android.permission.READ_PHONE_STATE” />
<uses-permission android:name=”android.permission.ACCESS_COARSE_LOCATION” />
<uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION” />
<uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE” />
And this line of codes too for AdMob
<activity android:name=”com.google.ads.AdActivity”
android:configChanges=”keyboard|keyboardHidden|orientation”/>
6. Add this code to the menifest file
<meta-data android:value=”here goes the key” android:name=”ADWHIRL_KEY” />
in between the application tags
<application>here</application>
and replace the “here goes the key” with your AdWhirl sdk key.
7. Add this code
xmlns:app="http://schemas.android.com/apk/res/com.adwhirl"
to the xml layout file just after
xmlns:android="http://schemas.android.com/apk/res/android"
8. Add this code to the same android layout file
<com.adwhirl.AdWhirlLayout
android:id=”@+id/adwhirl_layout”
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
/>
9. Add other ad networks “like AdMob, InMobi etc.” sdk jar files to your project build path too.
10. InMobi does not need any other coding, only it requires the sdk to be added.
11. Finally you may have to wait 3 or 4 days for your AdWhirl network to get the Ads. In the meantime the logcat may show fail errors.
12. I have successfully integrated AdMob and InMobi using these steps.
uninstall/delete an application from android emulator
First,make sure the emulator is running.Then follow below steps:
1. go to tools directory in command
2. adb shell
3. cd /data/app
4. ls (It will display all the .apk installed in your emulator)
5. rm ***.apk(which you want to remove)
6. exit
To remove the system apps
1. adb remount
2. adb shell
3. rm system/app/appname.apk
then run the project with eclipse , it works good.
Tips on How to install .apk files into the Android emulator (newer versions like android-sdk_r08-windows):
I am a Khulna University CSE Student and this is my blog…
Here I may post some tips for problems I am facing while developing my projects
The first one goes here……..
Once the emulator is set up follow the following instructions:
–Copy the file to “android-sdk-windows/platform-tools/” folder
— Open a command line window (cmd), change your directory to “android-sdk-windows/platform-tools/” using “cd” command where adb.exe and filename.apk is located .
–Run the adb command “adb install filename.apk” and enjoy…….