How to change Android Studio Keymap (MAC OS X)

It is very difficult for the eclipse users to switch to Android Studio, specially when it comes to keyboard shortcuts. So to solve this issue just follow the following steps.

1. Go to Preference from (cmd + ,)
2. From the left hand find Keymap under IDE settings
3. After selecting the Keymap, you will see in the right hand side a drop down menu under Keymap
4. Select Eclipse (Mac OS X)

And you are done

here are few keyboard shortcuts

1. format code: cmd + shift + f
2. up or down line of codes: alt + up key / down key
3. open resource: cmd + shift + t
4. comment line: cmd + /
5. delete line: cmd + d
6. go to line number: cmd + l
7. last edit line: ctrl + q
8. implement/override methods: cmd + o

If any of the shortcuts is not working you can always edit or add them from the keymap section.

enjoy 🙂

Android Time Class

Get Old Month Using Time Class

// Author: Mahbub


just provide the month, year and day and get previous dates

Since Time class does not provides months and day name, you have to do that by yourself

public void oldDate(int month, int year, int day) {

    oldDay = 1; // here i did not vary the old months date

    String s;
    for (int i = 1; i <= 5; ++i) { // i am fetching last 5 month data
        if (month == -1) {
            month = 11;
            year = year - 1;

        oldYear = year;
        oldMonth = month;
        Time old = new Time();
        old.set(oldDay, oldMonth, oldYear);
        s = "Month of "+old.month+ +old.year;
        // update