28 comments on “Android: Adding a change log dialog to your app

  1. Oh Martin,
    you are great! Thanks a lot for this useful library. Now I can replace my quick and dirty solution. :)

    Just one question: I want to write a short summary of the changes for each revision on the top of the li’s. Is it possible to “hack” this with styles easily.

    Greetings and recognition to your Code
    Felix

    • Sure it’s possible.

      You would just have to add an attribute to the release tag with a summary.
      Something like:

      <release version="1.4" versioncode="5" summary="This is my summary">
      

      And make sure to parse it in the changelog code in this function:

      	//Parse a the release tag and return html code
      	private String ParseReleaseTag(XmlResourceParser aXml) throws XmlPullParserException, IOException {
      		String _Result = "<h1>Release: " + aXml.getAttributeValue(null, "version") + "</h1><ul>";
              int eventType = aXml.getEventType();
              while ((eventType != XmlPullParser.END_TAG) || (aXml.getName().equals("change"))) {
              	if ((eventType == XmlPullParser.START_TAG) &&(aXml.getName().equals("change"))){
                  	eventType = aXml.next();
              		_Result = _Result + "<li>" + aXml.getText() + "</li>";
                  }
              	eventType = aXml.next();
              }		
              _Result = _Result + "</ul>";
              return _Result;
      	}
      

      This change should do the trick:

      String _Result = "<h1>Release: " + aXml.getAttributeValue(null, "version") + "</h1><br/>" + aXml.getAttributeValue(null, "summary") + "<ul>";
      

      Note I did not test this code. But it should be clear what changes need to be made to get it working.

  2. Hi Martin,

    Thanks for your very nice class.

    Do you have an idea about how to display the changelog only the first time the user launch the app, and not each time ? (may be in adding a boolean in settings ?)

    • If correct you should be able to put a translated xml file in a separate folder like so:
      xml (this is the default language folder, most likely English)
      xml-de (this is your translation folder, in this case German)

      The change log should get the correct translation according to the language set in the Android system.

  3. Hello Martin,
    Please add the code to run changelog only when first run app and after the release of code in AndroidManifest.xml

    Thanks you.

    • Hi Alex,

      This code has been replaced by the Inscription library.
      You can get the dev branch from Github, in there you will find a what’s new dialog that shows the latest changes at start up.

  4. Hi Martin! First of all i wanna say, Great tutorial! I am new to Android development and sometimes it can be hard to understand some other tutorials. I have used your “change log dialog” in my latest app that am working on. You can check it out at (http://bit.ly/qpinner) . Thanks!!!

    • Thank you.

      I Would recommend to use the new Inscription library if you are not yet using it. It contains the same change log dialog but has improved code.

      Good luck with your app. :)

  5. Good Idea man, but trying Inscription library in my app I’ve noticed that it’s too slow to check if it’s the first boot (or if the app has been updated) and in case show the Whatsnew/Changelog message.

    • The check should be almost instantaneous. It’s just a simple check on the shared preferences. Maybe the rendering of the dialog itself is causing delay?
      Does the check delay your startup or does the dialog not show at all? I’m wondering what the exact problem is you are dealing with.

  6. hi,Martin
    I’m Chinese
    Thanks your ChangeLogDialog,but it can show Chinese.
    So, I modify the source code:
    //Create webview and load html
    WebView _WebView = new WebView(fActivity);
    _WebView.getSettings().setDefaultTextEncodingName(“utf-8”);
    _WebView.loadDataWithBaseURL(“”,_HTML, “text/html”, “utf-8″,””);

    then,it works.

  7. hey dud this is an awesome tuts. but i had an error with
    ChangeLogDialog _ChangelogDialog = new ChangeLogDialog(this);
    _ChangelogDialog.show();
    there is changeLogDilog file in java which given by you but i still get error. help me resolve this

    thanks
    medy

    • Hi Medy,

      The best thing to do is use the Inscription library. It has example projects that you can import into Eclipse and see how to call the dialog. The code in this article is outdated and is replaced by the Inscription library. Please open the link “Inscription” on the main menu on the top of this website, there you will find a link to the project on Github.

  8. Hi Martin!

    Thanks for this great little piece of code. I’ve been using this for the last few months in my app, and it’s worked a treat. I’m glad I came across this site again, as I see you have a new library, thanks once once again! :)

    I wanted to ask, though, is there a way to have a clickable link in the changelog?

    • Thank you for you kind words :)

      Adding links to the change log is not possible at the moment. If you want you can fork the dev branch from the dev tree on GitHub and add the logic, once done you can make a pull request to merge your changes into the official library.

      The function you are interested in is the parseReleaseTag function in the ChangeLogDialog class.

Leave a Reply

Your email address will not be published. Required fields are marked *