background preloader

Android

Facebook Twitter

Stephanenicolas/robospice. Greenrobot/EventBus. Android Async HTTP Clients: Volley vs Retrofit - Instructure Tech Blog. We recently released a new version of our mobile app for Android.

Android Async HTTP Clients: Volley vs Retrofit - Instructure Tech Blog

Although it was a huge improvement from previous installments in terms of features, design, and usability, there was one nagging issue in the back of our minds: speed. There are times when the app isn’t as snappy as we’d like it to be. After some profiling, benchmarks, and common sense, we determined that retrieving data from the API (the networking) was the bottleneck.

The Old Way: AsyncTasks As of the latest version, we use the built-in AsyncTasks to retrieve data from Canvas’ servers. Introducing Volley and Retrofit Luckily, there are a few third party libraries that provide support for concurrent background threads, network caching, as well as other features that clean up networking code substantially. RoboSpice-InfoGraphics.png (600×5417) Note1. Demonstrate HTTP caching with OkHttp and Retrofit. Android: Loaders versus AsyncTask. One of the biggest pieces of Android that I have neglected to learn about would be Loaders.

Android: Loaders versus AsyncTask

Seeing as it’s time for me to learn it, perhaps I can help you out a bit with it as well. My main interest with the Loader concept is how it melds with the tried and true AsyncTask, and if it’s really better or not. AsyncTask Before getting into the Loader concept, it’s important to have a good idea of what the AsyncTask is and what it’s used for within Android. If you have written any sort of application for Android, chances are you have played with the AsyncTask, or at the very least heard of it. Configuration changes can mess things upPausing an activity doesn’t pause the AsyncTaskA fair amount of boilerplate code (which means more possible errors) Handling Runtime Changes. To test that your application restarts itself with the application state intact, you should invoke configuration changes (such as changing the screen orientation) while performing various tasks in your application.

Handling Runtime Changes

Your application should be able to restart at any time without loss of user data or state in order to handle events such as configuration changes or when the user receives an incoming phone call and then returns to your application much later after your application process may have been destroyed. To learn how you can restore your activity state, read about the Activity lifecycle.

However, you might encounter a situation in which restarting your application and restoring significant amounts of data can be costly and create a poor user experience. RoboSpice Motivations - Aplicaciones Android en Google Play. Join the G+ community and register as a tester to get latest alpha/beta versions: Andlytics collects statistics from the Google Play Developer Console.

RoboSpice Motivations - Aplicaciones Android en Google Play

It lets you track active installs, total installs, ratings, and comments for all your Android apps that are published on Google Play. Andlytics can also collect AdMob statistics, including revenue, requests and impressions. It supports background syncing of stats and notifications for when changes occur. Google does not provide a public API for collecting statistics. Andlytics is open source, please feel free to contribute via GitHub, Andlytics is not associated with Google in any way. "Google Apps for Business" and Multi-connected developer accounts are not supported yet.

On some devices AdMob accounts keep disappearing, moving Andlytics from sdcard to internal storage might fix this. For AdMob accounts that are linked to a Google Account you can find the API password on the Account Information page. Loaders. RoboSpice presentation. Android Fundamentals: Properly Loading Data. The UI thread is a bad place for lengthy operations like loading data.

Android Fundamentals: Properly Loading Data

You never know how long data will take to load, especially if that data is sourced from a content provider or the network. Android 3.0 (Honeycomb) introduced the concept of Loaders and, in particular, the CursorLoader class that offloads the work of loading data on a thread, and keeps the data persistent during short term activity refresh events, such as an orientation change. We'll incorporate the Loader as a new feature in our ongoing tutorial series building a yet-to-be-named tutorial reader application. If you were paying close attention to our last tutorial, Android Fundamentals: Working With Content Providers, you may have noticed that we took a shortcut. We used the managedQuery() method of the Activity class, which is a newly deprecated method. Implementing Loaders (part 3)

This post introduces the Loader<D> class as well as custom Loader implementations.

Implementing Loaders (part 3)

This is the third of a series of posts I will be writing on Loaders and the LoaderManager: First things first, if you haven’t read my previous two posts, I suggest you do so before continuing further. Here is a very brief summary of what this blog has covered so far. Life Before Loaders (part 1) described the flaws of the pre-Honeycomb 3.0 API and its tendency to perform lengthy queries on the main UI thread. Android Fundamentals: Properly Loading Data. Loading Data in the Background. Android Components. The CommonsWare Android Components, or CWAC, are open source libraries to help solve various tactical problems with Android development.

Android Components

Most CWAC components are packaged as a tiny JAR file that you can add to your project (e.g., drop it in libs/), requiring at most other CWAC JARs as dependencies. Most are also available as AAR artifacts in a CommonsWare repository, ready for inclusion in your Gradle-based project build scripts. The current supported CWAC components, and their GitHub repositories, are: cwac-adapter: Provides an AdapterWrapper, a simple wrapper class that, by default, delegates all ListAdapter methods to a wrapped ListAdapter. Condesales/easyFoursquare4Android. Path/android-priority-jobqueue. Android and REST. Path/android-priority-jobqueue. Nlefler/NLFoursquare-Android. Android Background Processing with Handlers and AsyncTask and Loaders.

Android Background Processing with Handlers and AsyncTask and Loaders - Tutorial Copyright © 2011, 2012, 2013 Lars Vogel Android Threads, Handlers AsyncTask This tutorial describes the usage of Threads, Handlers and AsyncTask in your application.

Android Background Processing with Handlers and AsyncTask and Loaders

It also covers how to handle the application lifecycle together with threads. It is based on Eclipse 4.2, Java 1.6 and Android 4.2. 1. Android modifies the user interface and handles input events from one single user interface thread. Google I/O 2010 - Android REST client applications. Thunsaker/soup. Creating a REST library using Retrofit & OkHttp. I've been tasked to modernize our application's networking layer.

Creating a REST library using Retrofit & OkHttp

We have been writing our own network manager to deal with http 302 redirect and caching responses, but there are many opensource project that already does these things very well. Saving (and Retrieving) Android Instance State - Part 1 - Intertech Blog. Why do we need to save instance state?

Saving (and Retrieving) Android Instance State - Part 1 - Intertech Blog

Android activities have a lifecycle (for a diagram of this lifecycle see here). As an activity becomes partially hidden (paused) or fully hidden (stopped), possibly even destroyed, your applications need a way to keep valuable state (i.e. data) the activity has obtained (probably from user input) or created even after the activity has gone away. As an example, an orientation change can cause your activity to be destroyed and removed from memory and then recreated again. Unless you avail yourself to certain state saving mechanisms, any data your activity has at the time of orientation change can be completely lost in this seemingly simple act. Robospice/dependencies/1.4.12 at repository · stephanenicolas/robospice.

Gson User Guide - gson. Serializing and Deserializing Collection with Objects of Arbitrary Types Sometimes you are dealing with JSON array that contains mixed types. For example: The equivalent Collection containing this is: Collection collection = new ArrayList(); collection.add("hello"); collection.add(5); OkHttp. Overview HTTP is the way modern applications network. Android : Volley and Gson tutorial. Android Volley is the new way to make network requests. It has a lot of advantages : configurable thread pool, request priority, caching, request cancel. AsyncTask is no more needed and this is a good new as AsyncTask is known for its memory leak issues. In this quick step tutorial, i show the piece of source code to make it work with google gson library. Test before If you wish to test before, you can install the application with the following link. Retrofit. Introduction Retrofit turns your REST API into a Java interface. public interface GitHubService { @GET("/users/{user}/repos") List<Repo> listRepos(@Path("user") String user);} The RestAdapter class generates an implementation of the GitHubService interface.

RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint(" .build(); GitHubService service = restAdapter.create(GitHubService.class); Each call on the generated GitHubService makes an HTTP request to the remote webserver. List<Repo> repos = service.listRepos("octocat"); Android Bootstrap. AndroidBootstrap/android-bootstrap. Libraries to use for easy asynchronous REST web requests and image loading. Services. A Service is an application component that can perform long-running operations in the background and does not provide a user interface. Another application component can start a service and it will continue to run in the background even if the user switches to another application.

Additionally, a component can bind to a service to interact with it and even perform interprocess communication (IPC). For example, a service might handle network transactions, play music, perform file I/O, or interact with a content provider, all from the background. Your app idea. Si vous voulez simplement lire le code , consulter des extraits ou des solutions fraîches sur - le - aller puis le code Peeker est pour vous! C'est un super petit lecteur de code (note : pas lire, pas un éditeur ) qui améliore la connaissance de codage actuel en mettant en évidence votre expertise codage passé. Avec le code Peeker vous pouvez partager des astuces de codage de réussite lors d'une entrevue d'emploi ou de réunions . Andersgoransson/eatbookexamples. AndroidDev people you should follow. Gson User Guide - gson. Context, What Context? - by Dave Smith of Double Encore. Context objects are so common, and get passed around so frequently, it can be easy to create a situation you didn’t intend.

Loading resources, launching a new Activity, obtaining a system service, getting internal file paths, and creating views all require a Context (and that’s not even getting started on the full list!) To accomplish the task. What I’d like to do is provide for you some insights on how Context works alongside some tips that will (hopefully) allow you to leverage it more effectively in your applications.

Context Types Not all Context instances are created equal. Handling Runtime Changes. Romannurik/Android-WizardPager. Modern techniques for implementing REST clients on Android 4.0 and below – Part 2 - neilgoodman.net. This is the second and last part of a tutorial on implementing REST clients using modern APIs introduce in Honeycomb and Ice Cream Sandwich. In the last part of this tutorial I covered how to make REST calls using Loaders and the LoaderManager class.

In this part of the tutorial, I will be covering how to make REST calls using Services and the motivations behind this approach. Rest interaction in Android. In last December ('13) I was asked to submit a talk proposal for the first Italian Droidcon, which I did. Consume Webservice in Android using intentService. Topics covered. What is Context in Android - SimpleCodeStuffs. Context is context of current state of the application/object.It€™s an entity that represents various environment data . Context helps the current activity to interact with out side android environment like local files, databases, class loaders associated to the environment, services including system-level services, and more. The Central Repository Search Engine. Android RoboSpice with GoogleHttpClient. Android Networking Without the Pain de Colin Lee en Prezi. SpiceManager in Application · Issue #211 · stephanenicolas/robospice.