Libraries to use for easy asynchronous REST web requests and image loading

Here is my list for good libraries to use for that purpose. I may come back later for comments but I’m just listing them now

Volley

https://android.googlesource.com/platform/frameworks/volley/

http://ogrelab.ikratko.com/android-volley-examples-samples-and-demos/

Tutorials:

https://github.com/dmytrodanylyk/dmytrodanylyk

http://www.michenux.net/android-volley-and-gson-tutorial-797.html

Image request : http://www.javacodegeeks.com/2013/11/android-volley-tutorial-post-and-download-image.html

Picasso

http://square.github.io/picasso/

Android Asynchronous

http://loopj.com/android-async-http/

RESTDoid

https://github.com/PCreations/RESTDroid

Retofit

http://square.github.io/retrofit/

Datadroid

http://www.datadroidlib.com/installation

Spring Android

http://projects.spring.io/spring-android/

Android jBridge

https://code.google.com/p/android-jbridge/

Resty

http://beders.github.io/Resty/Resty/Overview.html

mechanoid Ops

http://robotoworks.com/mechanoid/doc/ops/index.html

CRest

http://crest.codegist.org/

Helpful articles

http://blog.bignerdranch.com/3177-solving-the-android-image-loading-problem-volley-vs-picasso/

Fix Eclipse Slow update

Hello all,

I believe that many of eclipse users have faced this problem when updating plugin or something in eclipse , It is EXTREMELY SLOW .  All what you need to do to fix this is to uncheck the check box  “Contact all update sites” option in the update window ( when you click help> install new software) . and you are done.

 

best of  luck,

Thread vs Process and Service in Android – Part 1

The Problem

Service, Thread and  Process are terms that may cause confusion for many people who do programming in Android or similar platforms.  I’m  going to explain here what they are and the difference between the m in simple words.  I assume you already know the Android application components like activity, service ,….

Let’s start by some basic definitions ,,

Process

In general, You can define process as a program unit of execution that has its own allocated resources and memory.  Running programs usually consists of multiple processes (one main controller process and many childs) . Multiple processes are independent of each others and can communicate only via Inter Process Communication mechanisms  that are provided by the hosting operating system.

Aside: Have you heard that “Google Chrome” runs the tabs of the browser each in different process ? . By doing this, They provide isolation between the tabs handling web pages so each tab has it’s own resources and handling mechanisms. If one crashed, the others are still Ok. Because they are  independent  😉

Thread

Thread  is part of your program functionality that can run in parallel with the main application execution process (or thread). It runs withing a process. The process may contain only, and that’s rare, one thread and mostly contains multiple threads. Threads share the same resources and memory. Creating new thread need very less work that creating a new process.

Example: Multiple downloads that are running in the same time in a file downloader software. And you may ask here , but if one download crashes, the others are not!!. Yes.  I didn’t say threads are dependent of each others. I said they have the same resources allocated.

That was the difference between thread and process in general, lets go some inside Android.

In Android

When an application’s first  component starts , the Android system starts a new process for the application with a single thread of execution called “main” thread or “UI Thread“. This thread responsible for very important stuff like dispatching events to the user interface widgets. The started Process then may hold Activity, Service or BroadCastReceiver.

All components of the same application usually run in the same process. When new component is started, it will  , by default, run in the same thread and inside the application main process unless you provide some thing else.  For example if you run a service by startService() method from an activity, this service runs in the main application process and thread. This is called “Single Thread Model”.

In this case (running service from an activity to do some intensive work), this single thread model can cause poor performance and may cause your application not responsive and may also see the “ANR” dialog.

Here comes the need for creating worker thread(s) that runs in background in parallel with the “main” thread leaving the main “UI” thread responsive. This is a very common technique that you will do every day when developing Android apps.

Building Worker Threads in Android

Building worker threads can be done in several ways:

– Implementing Thread using the Java style ( Extending Thread class or Implementing runnable interface )

– In case we are working with services, You may use IntentService instead of Service class.

– For the problem of handling and updating user interface from different threads , the  Android SDK is shipped with many ready solution for  that like :

– Using AsyncTask

– Using the view.post method

….. and many others.

We may explore those solutions later in upcoming tutorials.

kindly leave you comments, corrections, additions or suggestions below .

 

Mohmmed Saudi.