Igor Khrupin

Experienced Android Software Developer

How to Clear User Data in your Android Application programmatically

How to clear user data of your application programmatically? Here I share you my solution how to do this.

You also can clear your user data by clicking “Clear Data” button in Settings–>Applications–>Manage Aplications–> YOUR APPLICATION
Application Info Android Dialog

To do it programmatically you need to remove user data from application dir.

Below you can download source code of sample Android project.

Pay attention in MyApplication class:

Download it from github


  1. Thanks for this informative post. I’m using Android and using “Clear Data” to clear user data. But programmatically option is new to me and I’ll try it on. :)

  2. Remote Data Centre

    22 November, 2011 at 06:46

    Oh this is sweet i know how to program a little bit. and this information will come in handy in the future.

  3. Cool buddy!! I’m following exactly same way you describe to clear my Android user data. It’s really good and thanks for informative info.

  4. I Was used this code in my personal code but data is not cleared properly some data is not cleared when i checked in settings->application->manage application->app_name.
    Every time near about 4 kb data is remaining ,idon’t know why?
    please help……………….

  5. Hi, Gagan Singh
    Are your application store all data in /data/data/ dir?

    I think it may happens if some of your app data stores in SD card.

  6. Thanks , I’ve been looking for this exactly .

    It comes very useful when performing clean-ups on Android JUnit Test.

    Thanks again :D

  7. Hi Igor,

    thank you for this very informative post. I was searching for a way to clear the app data programmatically and you give me the solution ;)

  8. Jorge Pizarro

    3 June, 2012 at 00:10

    is there a way to clear the data programatically, but leave out shared preferences untouched? thanks in advance

  9. Hi,

    is there any way to clear other applications app data or uninstall app silently ….i dont want clear my current app data ,need to clear other app data…

    • Hi sreelal,
      I think this is impossible to make clear data or remove other application without special permissions.
      I know about some special relations between application which signed with same certificate.

  10. very nice forum

  11. chillsakoon

    28 May, 2014 at 09:47

    Dear is there need any special permission in manifist file? for clear data, cache

  12. Very Good! I need this source… Thank you very very much!

  13. it was many useful for me .
    Thank a lot

  14. What should you put in the asterisks? (**********)

Leave a Reply

Your email address will not be published.


× 6 = forty eight

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

© 2014 Igor Khrupin

Theme by Anders NorenUp ↑