Debugging Android application via a wireless connection?

Sometime you don’t want to use USB cable (directly connect your device to computer) or you have problems with USB ports on your computer or something else.

Today, i finally found a really good solution to do this, it’s very simple. Read carefully all following steps below:

Step 1: Connect your device to computer via USB cable, make sure that “debugging mode” is activated. android device and computer must be connected to the same WIFI network (if you don’t know how to enable debugging mode,please search by google with keyword: “enable debugging mode in android”).
Step 2: Open CMD and run this command: adb tcpip 5555
Step 3: Run this command: adb shell netcfg to get your android device’s IP address.
Step 4: Continue to run command adb connect <IP_ADDRESS>:5555 and wait for a couple of seconds and then disconnect USB connection. Now you can properly run application in Android studio/eclipse, your device’s name still listed on the device choosing dialog, that really amazing!
When done, run this command: adb -s <IP_ADDRESS>:5555 usb to rollback to the previous setting (debugging via USB directly option).


Huy N

How to change screen orientation programmatically?

[code lang=”java”]
&lt;br /&gt;Configuration config = getResources().getConfiguration(); fragmentTransaction = getFragmentManager().beginTransaction();

switch(config.orientation) {
// Device is now in landscape mode.
MyLandscapeFragment fragment = new MyLandscapeFragment();
fragmentTransaction.replace(, fragment);
// Device is now in portrait mode.
MyPortraitFragment fragment = new MyPortraitFragment();
fragmentTransaction.replace(, fragment);


finally go to android manifest and make some changes for specified activity:


How to read JSON from assets in android?

Very easy to do this.

First, store your JSON file in “assets” folder of your project.

in this example, i use the JSON file with the content like below:


Next, see code snippet below, try to read and understand how it work:


That’s all i want to show you guys in this post.

Quick Torch – a simple app for tutorial

Hi guys! Today i have a new simple project, this demonstrate how to implement and create a simple torch for Android.

This is an Open-Source project and source code is now available here.


 Some screen-shots:

Easy to use with the only icon in main screen

or you can even use with a widget always appear on your home screen.



Thank you!

Huy Nguyen