Pages

Sunday, July 21, 2013

Prime Number Checking in java

public class PrimeTest {
public static void main(String[] args) {
// TODO Auto-generated method stub

for(int number = 2; number<=20; number++){
         //print prime numbers only
boolean r=false;
         for(int i=2; i<number; i++){
             if(number%i == 0){
             r=true;
             System.out.println(number+" is not prime");
             break;
             }
             else
             {
             r=false;
             }
          }
         if(r==false){
         System.out.println(number+" is prime");
         }
     }
}
---------------------------------------------------------------------------
Output:
----------------------------------------------------------------------------

Friday, July 19, 2013

Creating “HelloAndroid” project using android studio

To create a project in android studio please follow the following steps.
1.       Run android studio  


2.       Create a new project



3.       Choose options for basic settings



4.       Choose activity type for default activity



5.       Set name for default activity


6.       System will create project now

7.       Navigate to layout folder according to below image

8.       Double click on activity_hellow_activity.xml file
9.       Run application


10.   System will display output 

Wednesday, July 17, 2013

Installing Android Studio on windows 7

You need to follow the following steps to install android studio on windows 7 

1. Download and install jdk 1.7 or higher from the following url http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. Set JAVA_HOME environmental variable as follows. To do this follows the steps
Start menu>>right click on computer>>Properties>>Advanced System Settings >> Advanced>> Environment Variable>>New  

3. Download and install android studio. Download android studio from the following url http://developer.android.com/sdk/installing/studio.html

 You can view video tutorial for doing this from youtube.com. Visit the following url  http://www.youtube.com/watch?v=IaSduduwHKc