Android Libraries

Libraries:

  • AChartEngine : This is a library that lets you make and display all kinds of charts, from line to bar to scatter charts. A very good solution, should you need charts.
    Uses: Well… Charts!
    Made by 4ViewSoft.
  • ActionBarSherlock: This library will help you in maintaining an easy-to-use and consistent UI across all version of Android above 2.1.
    On Android 3.0+, it will use the native ActionBar, and below that, a backport of the 4.x native ActionBar has been used. Note that this is not needed if you want to target APIs that support the AB natively.
    Made by Jake Wharton.
  • aFileChooser: The basic version of Android File Chooser, it features somewhat less graphical hints about, for example, your current folder, but does provide a somewhat cleaner UI.
    Uses include a simple file chooser for opening a file from a specific folder.
    Made by Paul Burke.
  • android-hybridchoice: A ListView that lets users open a single list item, while also letting you select one or more other items. This way, you can (for example) view a mail while selecting others to throw away, instead of having to do that separately.
    Uses: Making any app with items that have detailed info in a ListView that can be changed.
    Made by Kiran Rao.
  • android-lockpattern: A library for you to include a lock pattern in your app. It was adapted straight from Android source code, and is very useful for keeping data secure.
    Uses: Root apps, apps with sensitive data or other apps that could hurt one’s phone.
    Made by Hai Bison.
  • Android FileChooser: Helps you in letting the user select a file. A visual GUI is made available to you and the user, through which the user can navigate to select a folder.
    Use cases: A file explorer, a downloading action, moving/copying files, etc.
    Made by Hai Bison.
  • Android Maps Extensions: A library that extends a number of Google Maps API v2 features. It features things like marker grouping, where it won’t display individual markers when there’s a lot of them together.
    Can be used in an application with a Maps View, to make it clearer and easier to understand.
    Made by Maciek G
  • Android Proxy Library: This lets you provide an easy and better (than Google’s) solution to the Android Issue 1273 (OF DOOOOOOOM!). It allows you to easily get the proxy settings of an Android device.
    Uses: You know, getting the proxy settings.
    Made by Marco Pagliari.
  • BetterPickers: A cool library that implements the Android 4.2 Clock time picker for you to use in your own apps as you please. It is a very nice way to keep your app Holo-themed, and it continues the push for a consistent UI in Android.
    Among others, uses include clock and calendar apps.
    Made by Derek Brameyer.
  • Build.prop Tools: A library to get access to the properties in a device’s build.prop, which include its codename, Android version, CPU name and others.
    Uses: Having to edit or otherwise get access to certain build.prop entries in your app, for example to display system info.
    Made by Jonathan Haylett.
  • Cieo: A library that lets you animate text. It is currently in very early Alpha stages of development, but does work.
    Uses: Word games, for example Hangman, where you can add a little extra to make it more dynamic.
    Made by Igor <LastNameUnknownException>.
  • DroidParts: This library helps you add the most used parts of Android apps without problems. It can help you add a number of more complicated parts that have been modded to be simpler, like an ImageFetcher and an improved ASyncTask.
    Uses: Just about every app can do this. Easier everything!
    Made by Alex Yanchenko.
  • droidText: A PDF creator library. Should you need to create a PDF easily, this is the library you want!
    Uses include parsing user input and saving it to a PDF file for later use, or to send (i.e. via email).
    Made by Markus Neubrand.
  • EventBus: This helps you tie together Activities, Fragments and background threads. It eliminates the need for overly complex listeners and interfaces, to make your life a lot easier.
    Uses: Apps with background threads, Activities and/or Fragments working together.
    Made by Markus Junginger.
  • FlipView: A FlipBoard-like animation to use for scrolling. Give your app a little extra eye candy, when you have multiple pages to scroll through.
    Uses: News readers and other apps that separate content into clear “pages”.
    Made by Emil Sjölander.
  • GAST (Great Android Sensing Toolkit): A library to help you use an Android phone’s internal sensors. It will help you control many sensor, including NFC, the camera and the accelerometer.
    Uses: A diagnosing app, or one that uses certain sensors for controlling an app feature.
    Made by Greg Milette and Adam Stroud.
  • GoogleDateTimePickers: TimePickers done right. A beautiful replacement for Google’s standard DatePickers and TimePickers, It is designed with the Holo style in mind, and makes it much, much easier to select the date and time of your liking.
    Uses: Letting the user pick a date or time, e.g. when setting an alarm.
    Made by Mirko Dimartino.
  • Hansel And Gretel: This allows you to visually display the Fragment Stack. When you open a new Fragment, it is added to a ‘tower’ of Fragments, from which you can also pop (remove) the top one. This library allows you to visually represent that Stack in your app.
    Uses: If, for example, you travel through multiple Fragments within one Activity, you can show which Fragments the user has gone through.
    Made by Jake Wharton.
  • HoloEverywhere: A library that backports the Holo UI design to earlier Android versions (like ActionBarSherlock does for the ActionBar). It uses the Android 4.1 Jelly Bean assets and makes them usable on Android versions 2.1 Eclair and up.
    Uses: An application that needs Holo on all platforms it runs on. Be aware that it might disrupt the UI consistency for the user, so think about that before including this in your app.
    Made by Sergey Shatunov and Waza_Be.
  • Inscription: For displaying information about your app to the user. It contains a ChangeLogDialog and a WhatsNewDialog, where the former displays more detailed information (version numbers, etc.) than the latter.
    Useful for showing a dialog after the user updated your app, without having to write too much code.
    Made by Martin van Zuilekom.
  • JacksonInFiveMinutes: A library to help in parsing and processing JSON, offering different ways to do so: A streaming API, a tree model and data binding.
    Of course, you can use this anywhere to parse JSON data (Twitter apps, for example).
    Made by Tatu Saloranta (?).
  • JazzyViewPager: Makes it easy to add a nice effect when changing pages with a ViewPager. Easily done: just add it, change some references and pick an animation!
    Uses: Spicing up your app’s animation portfolio, when using a ViewPager.
    Made by Jeremy Feinstein.
  • ListViewAnimations: An easy way of animating your ListView items easily and nicely, to give your app that little bit extra.
    Uses: To spice up any ListView that needs more fancies.
    Made by Niek Haarman.
  • NumericPageIndicator: A ViewPagerIndicator ‘plug-in’ that lets you easily display which page you’re looking at. For example, show “page 2 of 20” at the bottom of the page.
    Uses: Letting the user know which page they are on.
    Made by Manuel Peinado.
  • OrmLite: A library that simplifies database interaction in Android apps. It is designed to work with multiple database systems, including SQLite and MySQL.
    Uses: Database creation, management in Android. Various DB systems supported.
    Made by Gray Watson.
  • osmdroid: An almost full, free replacement of Google’s MapView. It includes numerous functionalities, like a number of on- and offline tile sources.
    Uses: To add a map to your app, and easily use functionalities surrounding it.
    Made by a number of non-disclosed awesome people!
  • PDFViewer SDK: A free PDF viewer library that works well. However, it does have a watermark on the screen, and you’ll have to pay to remove it.
    Uses are obvious: Building all kinds of PDF viewers!
    Made by GEAR.it.
  • PlayView: This helps you in creating a Google Play-like style in your UI, by extending the CardsUI library (which can be found in the PlayView thread).
    Good to use in an application where you want a nice smooth UI, with a modular and changeable look and feel.
    Made by Androguide.fr and GadgetCheck, among others.
  • ProgressButton: A nice library that shows you the progress of a download in the same button that you press to start the download. See Google Music for a working example.
    Comes in handy when there’s a list of items to download, and you want to facilitate easy downloading and keeping tracks of those downloads.
    Made by Prateek Srivastava, based off of Roman Nurik’s examples.
  • PullToRefresh: Expand a Listview (multiple versions are supported) with the ability to refresh its content upon pulling down at the top.
    Uses include social media clients, lists of other network-based updated items (orders, for example).
    Made by Chris Banes.
  • Remote Metadata Provider: Get system information about, for example, which music is playing on your phone. This could help you implement lockscreen music controls for your app.
    Uses: Lockscreen music controls, for example.
    Made by XDA member Dr.Alexander_Breen.
  • RoboSpice: A library that makes long-running asynchronous tasks easy. For example, it offers caching (very useful for orientation changes).
    Uses: Any app that implements an ASyncTask, especially when it is a bigger and longer-running one.
    Made by Octo Technology.
  • RootTools: This library will make it very easy for you to gain superuser access and execute commands based on that. This way, you can, for example, move and replace files anywhere on the system.
    This is especially handy when you are making a sort of backup app, or when you need the ability to do things that aren’t possible without root access.
    Made by Stericson.
  • ShowcaseView: This is a library that lets you highlight certain areas of the screen. Just like the Android launcher on first launch (or YouTube), it will allow you to tell the user how to interact with what, and what it does.
    Uses: Clarifying certain UI elements and their purpose to the user.
    Made by Alex Curran.
  • SlidingMenu: This lets you include a menu that slides into your app from the side, like the YouTube app has it. There, you can add a whole hosts of options and actions that don’t fit or belong in the ActionBar. SlidingMenu also lets you customise the menu. The new Android supportv4 library version, revision 13, also has a basic version of this.
    Uses: Menus with additional items, like channels in the YouTube app, shortcuts to your app’s settings, etc.
    Made by Jeremy Feinstein.
  • Spring For Android: A library that helps you integrate some features easily. For example, it can simplify using REST in your app.
    Uses: Whenever your app needs REST of auth support.
    Made by GoPivotal.
  • StandOut: A library that enables you to make your apps float! Basically, you can make any app you want float. Look in the thread for numerous examples!
    Useful when you are making an app that is also used parallel to other apps, like a calculator or note taking app.
    Made by Mark Wei.
  • StickyListHeaders: This is a great way to help you order alphabetised lists in a clear and very recognisable way. The current letter which you are scrolling through will be shown at the top of the screen, for as long as the first letter of the top item on the screen starts with that letter.
    Use cases are, for example, scrolling through songs, email addresses, names and articles.
    Made by Emil Sjölander.
  • Sugar ORM: An easy way to use SQLite libraries in your app. It takes away some of the more complex and annoying tasks of database management.
    Uses: Managing and querying SQLite databases in your app.
    Made by Satya Narayan.
  • UpdateChecker: This library is a quick and easy way of making sure that users know about updates to your app. It will show a Dialog every 5 times (by default) the app is launched, informing of an app update being available in the Play Store.
    Uses: Making sure people update your app. It is handy in just about every app.
    Made by Pietro Rampini.
  • ViewPagerIndicator: This library emulates the multiple ways of showing tab locations without using the ActionBar. This can be used to replicate the Play Store, older Google+ versions, launcher-like indicators and more!
    This library is always handy when using tabs, but without wanting to, for example, sacrifice too much screen real estate to use the ActionBar.
    Made by Jake Wharton.

Sites, etc. collecting libraries:

  • Android Libraries provides a big list of libraries for all sorts of tasks, including graphics engines.
  • Android Snippets is a collection of little snippets of code to help you in navigating some commonly (and less commonly) seen challenges in Android development.
  • AndroidKickstartR is a web-based tool for quickly starting an Android app, including a number of (library) options to help ease some of the pain of adding extras. Fair warning: this seems to include older versions of some things, double check the generated project.
  • AndroidViews for multiple nice UI-based libraries that help make your app look and work awesome!
  • DevAppsDirect is an app with examples of libraries. Test without setting up a whole new project!

 

Original Post; http://forum.xda-developers.com/showthread.php?t=2226547

 

In the last year or so, Android development has really come of age. Android Studio with Gradle at its core is a dash of light after Eclipse. Besides that, there are quite a few open source libraries that we use on a daily basis.

Here is a selection of five of our favorite ones and a list of links where you can find others.

Top 5 Android libraries

1. GSON

Gson is a Java library used for serializing and deserializing Java objects from and into JSON. A task you will frequently need to do if you communicate with APIs. We mostly use JSON because it’s lightweight and much simpler than XML.

// Serialize 
String userJSON = new Gson().toJson(user);

// Deserialize
User user = new Gson().fromJson(userJSON, User.class);

It also plays nice with the next library:

2. RETROFIT

From their site: “Retrofit turns your REST API into a Java interface.” It’s an elegant solution for organizing API calls in a project. The request method and relative URL are added with an annotation, which makes code clean and simple.

With annotations, you can easily add a request body, manipulate the URL or headers and add query parameters.

Adding a return type to a method will make it synchronous, while adding a Callback will allow it to finish asynchronously with success or failure.

public interface RetrofitInterface {

    // asynchronously with a callback
    @GET("/api/user")
    User getUser(@Query("user_id") int userId, Callback<User> callback);

    // synchronously
    @POST("/api/user/register")
    User registerUser(@Body User user);
}


// example
RetrofitInterface retrofitInterface = new RestAdapter.Builder()
            .setServer(API.API_URL).build().create(RetrofitInterface.class);

// fetch user with id 2048
retrofitInterface.getUser(2048, new Callback<User>() {
    @Override
    public void success(User user, Response response) {

    }

    @Override
    public void failure(RetrofitError retrofitError) {

    }
});

Retrofit uses Gson by default, so there is no need for custom parsing. Other converters are supported as well.

3. EVENTBUS

EventBus is a library that simplifies communication between different parts of your application. For example, sending something from an Activity to a running Service, or easy interaction between fragments. Here is an example we use if the Internet connection is lost, showing how to notify an activity:

public class NetworkStateReceiver extends BroadcastReceiver {

    // post event if there is no Internet connection
    public void onReceive(Context context, Intent intent) {
        super.onReceive(context, intent);
        if(intent.getExtras()!=null) {
            NetworkInfo ni=(NetworkInfo) intent.getExtras().get(ConnectivityManager.EXTRA_NETWORK_INFO);
            if(ni!=null && ni.getState()==NetworkInfo.State.CONNECTED) {
                // there is Internet connection
            } else if(intent
                .getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY,Boolean.FALSE)) {
                // no Internet connection, send network state changed
                EventBus.getDefault().post(new NetworkStateChanged(false));
            }
}

// event
public class NetworkStateChanged {

    private mIsInternetConnected;

    public NetworkStateChanged(boolean isInternetConnected) {
        this.mIsInternetConnected = isInternetConnected;
    }

    public boolean isInternetConnected() {
        return this.mIsInternetConnected;
    }
}

public class HomeActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        EventBus.getDefault().register(this); // register EventBus
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this); // unregister EventBus
    }

    // method that will be called when someone posts an event NetworkStateChanged
    public void onEventMainThread(NetworkStateChanged event) {
        if (!event.isInternetConnected()) {
            Toast.makeText(this, "No Internet connection!", Toast.LENGTH_SHORT).show();
        }
    }

}

4. ACTIVEANDROID

ActiveAndroid is an ORM for Android. It’s an abstraction over SQLite which allows you to communicate with a database on a device without writing SQL statements. An Object that extends ActiveAndroid Model can be saved to the database like this:

user.save();

which can easily replace a big SQL statement like this:

INSERT INTO Users (Nickname, Name, Address, City, PostalCode, Country) VALUES ('Batman','Bruce W','Palisades 21','Gotham','40000','USA');

An example of retrieving all users:

List<User> users = new Select().from(User.class).execute();

of which SQL counterpart would look like this:

SELECT Nickname, Name, Address, City, PostalCode, Country FROM Users;

ActiveAndroid is a nice way to remove a lot of boilerplate code used for working with databases. There are other open source solutions like GreenDAO and ORMLite

5. UNIVERSAL IMAGE LOADER

UIL is a library which provides asynchronous, out of the box loading and caching of images. It’s pretty straightforward to use:

imageLoader.displayImage(imageUri, imageView);

Although Picasso has a nicer API, it lacks in customization. With the UIL configuration builder almost everything can be configured (important for fetching and caching of really large images, which Picasso fails to do).

Good open source libraries will make your development a hell of a lot easier and faster. Popular libraries are often well tested and simple to use. In most cases you can easily import them into your Android Studio project from Maven. Add them into dependencies in your build.gradle file like this:

dependencies {
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.squareup.okhttp:okhttp:1.3.0'
    compile 'com.squareup.retrofit:retrofit:1.3.0'
    compile 'de.greenrobot:eventbus:2.2.+'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.1'
}

and after syncing you will be good to go to implement them into your app.

ADDITIONAL LINKS

One of the best sources for learning about Android libraries is Android Weekly, a weekly newsletter about Android development.

 

 

Original Post: https://www.infinum.co/the-capsized-eight/articles/top-5-android-libraries-every-android-developer-should-know-about

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s