
Implementation of the list of used libraries in the Android application. Attempt number 2
More recently I came across an article on Habr on how to implement a dialog box with a list of used libraries. The proposed option seemed to me too complicated, and the list itself looked crooked. In this regard, I decided to share a simpler and more elegant way to implement this functionality.
We write the dependency in the build.gradle of our module:
Now we need to create a list with the libraries used. To do this, create a license.xml file in the res / raw folder (you can use other names).
Example:
As you can see, we don’t need to write a huge text of the license, but we can only indicate its name. Based on this file, the library will generate HTML code, which will then be displayed in the dialog box. At the time of writing, the following licenses are supported:
You can also create your own license by inheriting from the License class and implementing abstract methods.
If the library does not have copyright, then we simply write:
It remains to write the code in our Activity:
Here is the output:

You can also create a license directly in Java:
The source code of the example can be found here . Thanks for attention.
We write the dependency in the build.gradle of our module:
compile('de.psdev.licensesdialog:licensesdialog:1.8.0')
Now we need to create a list with the libraries used. To do this, create a license.xml file in the res / raw folder (you can use other names).
Example:
Application Crash Reporting for Android (ACRA) http://acra.ch/ Copyright 2010 Emmanuel Astier & Kevin Gaudin Apache Software License 2.0 Android ViewPagerIndicator http://viewpagerindicator.com/ Copyright (C) 2011 The Android Open Source Project
Copyright (C) 2012 Jake Wharton Apache Software License 2.0 OrmLite http://ormlite.com/ Copyright Gray Watson ISC License PhotoView https://github.com/chrisbanes/PhotoView Copyright 2011, 2012 Chris Banes. Apache Software License 2.0
As you can see, we don’t need to write a huge text of the license, but we can only indicate its name. Based on this file, the library will generate HTML code, which will then be displayed in the dialog box. At the time of writing, the following licenses are supported:
- Apache Software License 2.0
- BSD 2/3 Clause License
- Gnu General Public License 2.0 / 3.0
- GNU Lesser General Public License 2.1 / 3
- MIT
- Mozilla Public License 1.1
You can also create your own license by inheriting from the License class and implementing abstract methods.
If the library does not have copyright, then we simply write:
It remains to write the code in our Activity:
new LicensesDialog.Builder(this)
.setNotices(R.raw.license)
.build()
.showAppCompat();
Here is the output:

You can also create a license directly in Java:
final String name = "LicensesDialog";
final String url = "http://psdev.de";
final String copyright = "Copyright 2013 Philip Schiffer ";
final License license = new ApacheSoftwareLicense20();
final Notice notice = new Notice(name, url, copyright, license);
new LicensesDialog.Builder(this)
.setNotices(notice)
.build()
.showAppCompat();
The source code of the example can be found here . Thanks for attention.