How do I compare two files using Eclipse? Is there any option provided by Eclipse?

Just select all of the files you want to compare, then open the context menu (Right-Click on the file) and choose Compare With, Then select each other..

by Doon on stackoverflow’s  How do I compare two files using Eclipse? Is there any option provided by Eclipse?


How to load my app from Eclipse to my Android phone instead of AVD


How to load my app from Eclipse to my Android phone instead of AVD (question made by Dalmas). http://stackoverflow.com/questions/4992357/how-to-load-my-app-from-eclipse-to-my-android-phone-instead-of-avd

How to enable USB debugging on your Android Phone (explained by  ). http://www.groovypost.com/howto/mobile/how-to-enable-usb-debugging-android-phone/

What I extracted from both resources:

— Android Phone Info —

Modelo: U8180

Versão Android: 2.2.2k

The first thing I need to do is to be able to enable USB debugging on my Android Phone.

1 – Go to Settings.

2 – Select Applications.

3 – Click on Development

4 – Enable USB debugging.

Now its time to deal with Eclipse. I want to run my app not in a emulator (AVD) but directly in my phone.

…to be continued….got some trouble with Huawei U8180 drivers….

Java – How to get current datetime

I want to thank mkyong for sharing this with the world. (source: http://www.mkyong.com/java/java-how-to-get-current-date-time-date-and-calender/)

Basically if you want to get the current datetime in Java there are two ways:

  1. Using Date() + SimpleDateFormat()
    DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    Date date = new Date();
  2. Using Calender() + SimpleDateFormat()
    DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    Calendar cal = Calendar.getInstance();

Making My First Android Application – Hello World!

Now that I have set my development environment it’s time to make my very first application. The very well known “Hello World!”.

For this I follow another one of TugaBest tutorials that he shared in AndroidPT Forum and that you can access it here.

The first thing that it is needed is a AVD (Android Virtual Device) to emulate a device. To create one, on window console,go to android-sdks directory and simply type :

>android list targets

A list of possible devices and android versions is presented to you. In my case, I’m going to chose one that is running android 2.2 (id = 1). So I type

>android create avd -t 1 -n my_avd_1 -a

(-t means target, -n means name, -a means to create snapshot)

say no to create a custom hardware profile. Because you are not doing any changes to the default profile.

Now it’s time to create a new project in Eclipse

File > New > Project > Android > Android Application Project.

The New Android Application Window opens and I filled all the fields.

  • Application Name
  • Project Name
  • Package Name
  • Minimum Required SDK (I chose API 8: Android 2.2 (Froyo))
  • Target SDK (I chose API18: Android 4.3)
  • Compile With (API18 Android 4.3)
  • Theme

Then I pressed Next.

On the next window I’ve checked:

  • Create custom launcher icon
  • Create activity
  • Create Project in Workspace

And then Next again.

The next window lets me customize the logo for my application. After customization I pressed Next.

Its now time to create a new Activity.
An Activity is the simplest entity used to execute actions. The same application can have several activities. But the user can only interact with each one of a time.

I chose to start with a Blank Activity.

And then Next again.

Then finally I supplied:

  • The Activity Name  (HelloWolrd)
  • Layout Name (activity_hello_world)
  • Navigation Type (None)

And then pressed Finish.

A little more theory…

An Android Interface is a combination of object hierarchies. These objects are called Views and they are of drawable type.  Each of these drawable objects/views is used as a layout element (such as, a button, an image or a label). And each type of element it’s a subclass of View. For example, the subclass of View that represents Text is called TextView.

In the image is listed all the steps needed to display the text “Hello, World!”.

First we need to create the subclass of view that represents the Text Element.

TextView tv = new TextView(this);

The input (this) of the constructor its an Android Context. A Context is an handler to the system. It stores services like resources, database access and settings. Each Activity and therefore each subclass of Activity inherits from Context.

After creating the object/view we need to set the actual text to be displayed. So we need to add the line:

tv.setText(“Hello, World!”);

In order to be seen in the monitor we need to set a UI for this object. That’s why we need to add the line:


Accordingly to the amazing tutorial posted by TugaBest in AndroidPT Forum. The only thing that it’s missing is to run the created app.

To do it so,

Go to Eclipse Menu Run > Run

On the next window (Run Configurations) select your app under Android Application and run it.

Making My first Android Application – Configure Android’s Development Environment.

The first step to make an android application is to have a very well configured environment. To do so I have follow the amazing tutorial that TugaBest shared in AndroidPT forum. You can access it here

It requires:

  • Java JRE and SDK (mine is version is 1.7.0_25)
  • Eclipse IDE (mine is Juno 4.2.0)
  • Android SDK (mine is v22)
  • Eclipse ADT Plugin

At voilá, you got yourself the perfect environment to work.


Android KitKat (4.4) to Follow Jelly Bean

Android is the operating system that powers over 1 billion smartphones and tablets. Since these devices make our lives so sweet, each Android version is named after a dessert: Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwich, and Jelly Bean. As everybody finds it difficult to stay away from chocolate we decided to name the next version of Android after one of our favorite chocolate treats, Kitkat®! (source:http://www.android.com/kitkat/index.html).

It’s rumored to be release this October together with the new Nexus from LG.