Archive for category Android

Including Apache HTTP Client on Android Studio


Android Studio - Apache HTTP Client

In order to use Apache HTTP Client (httpclient y httpmime) in Eclipse I used to download the Android port and then include the dependencies specifying the jar files: /home/lgallard//Android/libs/httpcore-4.3.2.jar /home/lgallard//Android/libs/httpmime-4.3.5.jar I kept this practice after migrating my projects to Android Studio, but I used Gradle to resolve the remaining libraries. Then to uniform everything, I did a research on how to include them. Just add the following lines to your app’s build.gradle file:

apply plugin: ''

android {

    dependencies {
        compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: ''
        compile (group: 'org.apache.httpcomponents' , name: 'httpmime' , version: '4.3.5') {
        exclude module: 'org.apache.httpcomponents:httpclient'}

    android {
        useLibrary 'org.apache.http.legacy'


Then sync gradle and compile your project again.

Reference: Apache HttpClient Android (Gradle)



How to enable the Web UI on qBittorrent

If you want to manage your qBittorrent server using a web interface, follow these steps:

  1. On the menu bar, go to Tools > Options qBittorrent WEB UI
  2. In the new window, choose Web UI option
  3. Check Enable the Web User Interface (Remote control) option
  4. Choose a port (default 8080)
  5. Set username and password (default username: admin / password: adminadmin) WEB UI
  6. Click on Ok to save settings.

Now in a browser you can check your qBittorrent server if you put your server’s IP address and port, example: as show below: qBittorrent Web UI You can also access it from your Android device by installing qBittorrent Client or qBittorrent Client Pro: qBitttoren Client Pro

, ,

No Comments

Programming Mobile Applications for Android Handheld Systems course

Programming Mobile Applications for Android Handheld Systems

Coursera just sent me the certificate for completing with distinction the course Programming Mobile Applications for Android Handheld Systems. This course is endorsed by the university of Maryland and lectured by Dr. Adan Porter.

Something worthy to mention about this Android course is that it’s really well structured, and the good quality of the videos and assignments. It makes me recall my time at college because the projects are very organized with clear objectives. In fact project’s evaluations are done automatically with JUnits. But the final project is evaluated by other peers (4 in total).

For this course I took the Signature Track, which is the paid option where the identity is checked by a keyboard pattern recognition software and verified by checking  the student’s photo (at the end of the course some assistants check those pics). With these validations they grant a certificate that can be verified using the following links:

If you are interested in this course, you can see the course’s content follow the above link.



Course Creative, Serious and Playful Science of Android Apps

Coursera androidapps101 2014 Computer Science and Programming Badge

Recently I received the awards for the Android course Creative, Serious and Playful Science of Android Apps lectured by Lawrence Angrave from University of Illinois at Urbana-Champaign. The course was designed to learn Android programing from scratch, therefore if you are interesting in developing for this platform this is a good starting point. The video lectures were made in English, but there are subtitles for Spanish and even English, so language is not barrier.

The Awards

The awards I earned were these:

  • Statement of Accomplishment:  This is a sort of of certificate which you earn when accomplishing 70% or higher. I got 94.6%
  • Computer Science and Programming Badge: This is a kind of badge they gave you also when you accomplished 70% or higher.

This awards are not part of the Signature Track, which let you share and validate this grade,  but you have to pay $49 for this feature.


No Comments

qBittorrent Controller for Android

Download application

If you are interested in this application you can install it from Google Play or download qBittorrent Controller apk on your device. Also you can download the code from GitHub because it was released as LGPL.


  • See two panel view (fragments), for torrent list and details in the same window
  • Drawer menu for switching between All, Downloading, Completed, Paused, Active and Inactive torrent list
  • Pause or resume all torrents from the selected list
  • Auto refresh torrent list after performing an action on a torrent (pause, resume, or delete)
  • Add URL directly or by clicking the torrent link on your device’s browser
  • Pause, resume, delete or delete individual torrents with its downloaded data
  • Set and save a connection account

Phone’s view

Tablet’s view



My first application on Android: BatteryReporter


From a while I wanted to learn how to develop Android applications and when I saw that open a course at Coursera for developing Android appslications so I took the chance to learn. I must confess that it not  a piece of cake, I mean, it just not “copy and paste” code (although you can find example codes out there) and you must learn new concepts, because although you have programmed before (even Java) now you must learn how to do it the “Android’s way”.

After following the video lectures, read and read a lot, I build my first application, which in deed is part of the first assignment for the course. It’s a simple application which reads the device’s battery, and reports if it is charging or discharging, as well as the percentage of charge of the device.

For those interested in try my first application, or just take a look to the code for learninf, here I leave the apk file and the main code.

The code (

Here you can take a look to the code for the application:

package com.lgallardo.batteryreporter;
import android.os.BatteryManager;
import android.os.Bundle;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.view.Menu;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends Activity {
 protected void onCreate(Bundle savedInstanceState) {
 public boolean onCreateOptionsMenu(Menu menu) {
 // Inflate the menu; this adds items to the action bar if it is present.
 getMenuInflater().inflate(, menu);
 return true;
public void getStatus(View view) {
TextView statusValueTextView, chargingValueTextView, levelValueTextView;
 ImageView iconImageView;

 String charging = "";
int level, scale;
 float batteryPct;
// Get resources reference
 Resources res = getResources();
// Get values TextViews
 statusValueTextView = (TextView) findViewById(;
 chargingValueTextView = (TextView) findViewById(;
 levelValueTextView = (TextView) findViewById(;

 // Get ImageView (icon)

 iconImageView = (ImageView) findViewById(;

 // Get battery's status
 IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
 Intent batteryStatus = registerReceiver(null, ifilter);
// Check if the battery is charging or is charged?
 int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
 boolean isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING
 || status == BatteryManager.BATTERY_STATUS_FULL;
// Update UI status
// Update UI charging
 if (isCharging) {
 charging = res.getString(R.string.yes);
// Get charging method
 int chargePlug = batteryStatus.getIntExtra(
 BatteryManager.EXTRA_PLUGGED, -1);
 boolean usbCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_USB;
 // boolean acCharge = chargePlug ==
 // BatteryManager.BATTERY_PLUGGED_AC;
if (usbCharge) {
 charging = charging + " " + res.getString(R.string.usb);
 } else {
 charging = charging + " " + res.getString(;

 } else {
 charging = res.getString(;
// Update UI level
 level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
 scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
 batteryPct = 100 * level / (float) scale;