jueves, 28 de noviembre de 2013

Cast from Object to Integer


Problem:

I need to cast from Object to Int.

Solution:

If you're sure that this object is an Integer :
int i = (Integer) object;
Or, starting from Java 7, you can equivalently write:
int i = (int) object;
Beware, it can throw a ClassCastException if your object isn't an Integer and aNullPointerException if your object is null.

lunes, 7 de octubre de 2013

How to Install Android on Notebook or computer

how run android on pc
The success of Android mobile platform Android is much more than a million active applications, there is a small span. Android powers millions of phones, tablets and netbooks and desktops now. Yes, you heard me right.
How to run Android on a computer
You can also run Android on your netbook or desktop. In this post, I'll let you run Android on your laptop or netbook.

Things you need

Before you start reading this tutorial, make sure you gather all the necessary items.

  •       A USB drive or pen drive with 256 MB + Space. (Or CD)
  •       A custom netbook or desktop (click here)
  •       Some of the basic computing skills
  •       And of course - this guide

How to Install Android on a computer or Notebook

Follow the step to step guide for installing Android on your device. It may take up to 30 minutes for installation.
Preparing USB drive
Step 1: Format your USB drive to back up your important data first.

Step 2: Now go to this link http://www.android-x86.org/download and find your device is compatible with the Android version. Once you click on View and download to find out.

Step 3: Now that Android-x86 download, and on the other hand be able to download UNetbootin, click here to download. The software to USB drive. Iso will help you unpack and a bootable device.

Step 4: Once you get to download two files, open UNetbootin. Diskimage tick button.
how to instal android on pc
Now down list, select from the ISO. Android-X85 file by clicking the Browse ... 'Button. Now the rest of the settings and click OK.
run android apps on windows pc free download
How to run Android on a computer

Now let UNetbootin USB drive you want to download files. Once the file you want to run in the same android device, reboot, or load end. If you want to run, then out of the other android device.
Note: If you wish, you can burn the CD on the android-x86 iso.
How to run Android Apps on your Windows pc using a free software

 Installing Android on a computer

Now that you've made ​​USB or CD, the next step is to install on your computer or laptop, or netbook.

Step 1: Plug your Android and then reboots the system you want to install the device in your USB.

Step 2: Start up, you computer will ask you to boot the device. Select your USB drive for booting.

(Some computers, you can choose to boot from USB on your computer, the boot process will need to press the F2 or F10 key)

When you boot the computer USB discharge starts, it shows the installation setting.

Step 3: Select the Live CD - the installation without running the Android-x86. From the selection of the installation.
 Android phone to your PC
 Step 4: Wait for few minutes, The Setup will boot Android. After few minutes, You'll see Android Desktop.


 How To Run Android Apps on Your Windows PC

lunes, 4 de febrero de 2013

Converting from Editable to int in android


How to converting from Editable to int in android


Problem:

Need to convert from Editable to int

Solution:

Integer.ParseInteger(R2.getText())

Source: stackoverflow

Prompt User Input with an AlertDialog


How to prompt User Input with an AlertDialog


Problem:

Need to ask you some information to user using an Alert Dialog:

Solution:

AlertDialog.Builder alert = new AlertDialog.Builder(this);

alert.setTitle("Title");
alert.setMessage("Message");
// Set an EditText view to get user input 
final EditText input = new EditText(this);
alert.setView(input);

alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
  String value = input.getText();
  // Do something with value!
  }
});

alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
  public void onClick(DialogInterface dialog, int whichButton) {
    // Canceled.
  }
});

alert.show();

Source: Android Snippets