Tuesday, March 4, 2014

The wicked adb devices ?????? no permissions error

I have solved it.

I searched it a lot. Did not get a complete solution.

So what I did was:

1) Plugin your Android.
2) >lsusb
Bus 002 Device 006: ID 18d1:d002 Google Inc.
3) create a new file in /etc/udev/rules.d
by the name of 99-android.rules
Insert the following:
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666"
4) Phone prompts for permission grant
5)adb kill-server
6)adb devices (this automatically starts the server as well)
List of devices attached
xxxxxxxxxxx    device


Thursday, December 5, 2013

What to do to stop a thread in Android?


if(threadOne != null) {
Thread temp = threadOne;
threadOne = null;

Declare threads as Daemon threads.


Excelent repository for Android Source Code

I recently found out an excellent repository for android source code.


Thanks to people who took time to develop this.

Android Implicit Intent

How to login to my android device from terminal


1. sudo adb start-server

2. Check whether you are able to view your device
sudo adb devices

3. Start the shell:
sudo adb shell.

Listing all the packages installed:

pm list packages

Sunday, November 24, 2013

ArrayList printing Hashcode

When we try to print an ArrayList all at once we get

getClass().getName() + "@" + Integer.toHexString(hashCode())

In order to print the individual values, we need to change the toString() method in the class containing the setters/getters.

Add the following:

If your ArrayList is (snippets from my code):

ArrayList<Reservation> reservationsList = new ArrayList<Reservation>();
Reservation reservation;
reservation = new Reservation();

                // Does this work with recurring apps?
                reservation.setStartDate(new Date(cursor.getLong(3)));
                reservation.setEndDate(new Date(cursor.getLong(4)));

 //Add the overriden toString() method

    public String toString() {
        return ("Description:" + "\n" + this.getDescription() + "\n"
                + "Start Date:" + "\n" + this.getStartDate() + "\n"
                + "End Date:" + "\n" + this.getEndDate() + "\n"
                + "Location :" + "\n" + this.getLocation());

Sunday, October 20, 2013

Android Accelerometer Program

Topic: Reading from android phones accelerometer and posting it in RESTful way to a URL.



1. Create a new android project.
Keep all the setting to default.

Application name: AccelerometerDemo
1) Write code.

2) Check on simulator.

3)Write code for RESTful POST.

4) Correct format of the passing string or array whichever the case may be.

5) Check on real device.

6) Check when to send the post, periodically or with push of  a button.