Wednesday, May 13, 2015

Simple android program to make menu

In android menu is use fro any task like search,delete etc. Here we are using option menu. In this menu will be open when we click on menu. a list will be open that show the items we entered in the menu.
                                In activity_main.xml file we take LinearLayout and a text box.
                                In menu.xml file we take three options next, previous and list options to select.
                                In java file we give all the menu values in the toast. Means the value selected by user will display on the screen for short period of time.
 

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

   <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/welcome"
    android:textSize="20sp" android:textStyle="bold" android:capitalize="none" android:typeface="sans"/>

</LinearLayout>

MainActivity.java
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import android.view.MenuInflater;

public class MainActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
   
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu, menu);
        return true;
    }
   
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case R.id.next:
            Toast.makeText(this, "You have chosen the " + getResources().getString(R.string.next) + " menu option",
                    Toast.LENGTH_SHORT).show();
            return true;
        case R.id.previous:
            Toast.makeText(this, "You have chosen the " + getResources().getString(R.string.previous) + " menu option",
                    Toast.LENGTH_SHORT).show();
            return true;
        case R.id.list:
            Toast.makeText(this, "You have chosen the " + getResources().getString(R.string.list) + " menu option",
                    Toast.LENGTH_SHORT).show();
            return true;
        default:
            return super.onOptionsItemSelected(item);
        }
    }
}

menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
      <item android:id="@+id/next"
              android:icon="@drawable/ic_next"
              android:title="@string/next" />
      <item android:id="@+id/previous"
            android:icon="@drawable/ic_previous"
            android:title="@string/previous" />
      <item android:id="@+id/list"
            android:icon="@drawable/ic_list"
            android:title="@string/list" />
</menu>

strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="welcome">Click on the Options Menu to view the available Menu Options</string>
    <string name="app_name">Options Menu Example</string>
    <string name="next">Next</string>
    <string name="previous">Previous</string>
    <string name="list">Show List</string>
</resources>

Simple Android program on Toast

In android toast is use to show the notification on the screen for some period of time. Showing period will define by the user. If we take short in toast then notification will be for the short period of time and if user take then notification will increase some time to show the notification. Time period will depend on users system.
In xml file we take Relative layout and a text view. In java file we take only toast and a message that will bi show in the notification. Here we take short length so notification will display on screen for short period of time. Here we can take long also then notification will display for long time. 

activity_main.xml
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
   
    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

</RelativeLayout>


MainActivity.java
package com.example.toast; 
    import android.os.Bundle; 
    import android.app.Activity; 
    import android.view.Menu; 
    import android.view.View; 
    import android.widget.Toast; 
     
    public class MainActivity extends Activity { 
         @Override 
            public void onCreate(Bundle savedInstanceState) { 
                super.onCreate(savedInstanceState); 
                setContentView(R.layout.activity_main); 
                 
               Toast.makeText(getApplicationContext(),"Hello Android Devoloper",Toast.LENGTH_SHORT).show();        
            } 
     
            @Override 
            public boolean onCreateOptionsMenu(Menu menu) { 
                getMenuInflater().inflate(R.menu.activity_main, menu); 
                return true; 
            } 
     
    }  


manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.alertdialogbox"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.toast.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Tuesday, May 12, 2015

Simple android program for Check box

Check box is the state button to check that state is checked or nor. It is like a radio button in radio button in the same class we can choose only one state but by the use of Check box we can take more then one options in the same class.
                                 In xml file we take the foue check boxes and give the different values to each check box. We give the name of courses to each check box.Courses are Android, PHP, Dot Net and java.
                                 In java file we give the amount of all courses and if user select more then one course then the amount will be added. After clicking the button user will get total amount that will be show on the screen for a short period of time because we show total amount in toast.
                                 No need to change in the manifest file. Because we are not adding any additional class and no any information for the permission. So need to change in the manifest file.

activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <CheckBox
        android:id="@+id/checkBox1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:text="Android" />

    <CheckBox
        android:id="@+id/checkBox2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/checkBox1"
        android:text="PHP" />

    <CheckBox
        android:id="@+id/checkBox3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/checkBox2"
        android:text="Dot Net" />

       <CheckBox
        android:id="@+id/checkBox4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/checkBox3"
        android:text="Java" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/checkBox4"
        android:layout_marginTop="100dp"
        android:text="Select Course" />

</RelativeLayout>

MainActivity.java
package com.example.checkbox;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;

public class MainActivity extends Activity {
    CheckBox pizza,coffe,burger;
    Button buttonOrder;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
addListenerOnButtonClick();
}
public void addListenerOnButtonClick(){
android=(CheckBox)findViewById(R.id.checkBox1);
php=(CheckBox)findViewById(R.id.checkBox2);
dotnet=(CheckBox)findViewById(R.id.checkBox3);
        java=(CheckBox)findViewById(R.id.checkBox4);
buttonSelect=(Button)findViewById(R.id.button1);

buttonOrder.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View view) {
int totalamount=0;
StringBuilder result=new StringBuilder();
result.append("Selected Items:");
if(android.isChecked()){
result.append("\nAndroid 9000Rs");
totalamount+=9000;
}
if(php.isChecked()){
result.append("\nPHP 5000Rs");
totalamount+=5000;
}
if(dotnet.isChecked()){
result.append("\nBurger 4000Rs");
totalamount+=4000;
}
                        if(java.isChecked()){
result.append("\nJava 6000Rs");
totalamount+=6000;
}
result.append("\nTotal: "+totalamount+"Rs");
Toast.makeText(getApplicationContext(), result.toString(), Toast.LENGTH_LONG).show();
}

});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}

}


manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.checkbox"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.checkbox.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Android program to make a Spinner view

To make a spinner we take the spinner in xml file. Directly drag and drop the spinner. Spinner  the way to select any item from the list that we want to choose. Spinner view is like a drop down list on any thing.
In java file we take the array to store the values that we want to see in the drop down list. After storing the values in the array we apply the toast on that values. when a user select any item then the result will show for some period of time. We apply the toast so result will show for certain period of time.
In manifest.xml no need to change any data. All services in the manifest file is already in correct format so no need to change in manifest file.

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

<Spinner
android:id="@+id/Spinner01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawSelectorOnTop = "true"></Spinner>
</LinearLayout>


SpinnerView.java
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;
import android.widget.AdapterView.OnItemSelectedListener;

public class SpinnerView extends Activity {
String[] androidBooks = 
{
"Cup-Cake",
"Donut",
"Eclair",
"Froyo",
"Gingerbeard",
"Honeycomb",
"Ice-cream sandwitch",
"Jelly bean",
"Kitkat",
                "Lollipop"
};
Spinner sp;
/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        sp = (Spinner)findViewById(R.id.Spinner01); 
        
        ArrayAdapter<String> adapter = new ArrayAdapter<String> (this,android.R.layout.simple_spinner_item,androidBooks);
        
        
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        sp.setAdapter(adapter);
       
        sp.setOnItemSelectedListener(new OnItemSelectedListener() {

public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
Toast.makeText(getBaseContext(),arg0.getSelectedItem().toString(),Toast.LENGTH_SHORT).show();
}

public void onNothingSelected(AdapterView<?> arg0) {
}
       
        });
    }
}

manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.sai.samples.views"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".SpinnerView"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
    <uses-sdk android:minSdkVersion="7" />

</manifest> 

Android program on Frame Layout

In frame layout we divide the screen in frames. In given example we take a picture and then write some data on that picture.So for that we take an image view and two text view to write some text on the image.
In activity_main.xml file we take a frame layout. then we take an image view and two text view on that image. One text view is on the top of the image and second text view is set in the center of the image.
Now no need to change in java file. Delete some data from java files that is unnecessary. In manifest file no any need to change the data.
For image on the screen take a pic in the drawable and give the path in the android:src field.

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <ImageView
        android:src="@drawable/icon1"
        android:scaleType="fitCenter"
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"/>
    <TextView
        android:text="This is Frame Layout!!!"
        android:textSize="24px"
        android:textColor="#cc0000"
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:gravity="top"/>
    <TextView
        android:text="Android Development on Image"
        android:textSize="24px"
        android:textColor="#00dd00"
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:gravity="center"/>
</FrameLayout>

MainActivity.java
package com.example.framelayout1;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

}

manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.framelayout1"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.framelayout1.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Android Program on Alert Dialog box

We use Java file, Xml file and Manifest file to make a app for Alert Dialog box. In xml file we take one text view and three buttons. On the click of any button a dialog box will be open for short period time. We write the message in the toast so it will take some time to show on the screen.In java file every button is performing different actions.
           In manifest file no change will be done. because every permission is ok in manifest file.

activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView1"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="64dp"
        android:text="Button" />

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button1"
        android:layout_below="@+id/button1"
        android:layout_marginTop="28dp"
        android:text="Button" />

    <Button
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button2"
        android:layout_below="@+id/button2"
        android:layout_marginTop="30dp"
        android:text="Button" />

</RelativeLayout> 


MainActivity.java
package com.example.alertdialogbox;

import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends Activity {

Button B1,B2,B3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
B1=(Button) findViewById(R.id.button1);
B2=(Button) findViewById(R.id.button2);
B3=(Button) findViewById(R.id.button3);
B1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
final AlertDialog  alertDialog = new AlertDialog.Builder(MainActivity.this).create();
alertDialog.setTitle("Alert Dialog");
alertDialog.setMessage("Welcome to AndroidHive.info");
alertDialog.setIcon(R.drawable.icon_smile);
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getApplicationContext(), "You clicked on OK", Toast.LENGTH_SHORT).show();
}
});
alertDialog.show();
}
});
B2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
//alertDialog.setButton2(text, listener)
AlertDialog.Builder  alertDialog = new AlertDialog.Builder(MainActivity.this);
alertDialog.setTitle("Alert Dialog");
alertDialog.setMessage("Welcome to google.co.in");
alertDialog.setIcon(R.drawable.icon_smile);
alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getApplicationContext(), "You clicked on NO", Toast.LENGTH_SHORT).show();
}
});
alertDialog.show();
}
});

B3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
AlertDialog.Builder  alertDialog = new AlertDialog.Builder(MainActivity.this);
alertDialog.setTitle("Alert Dialog");
alertDialog.setMessage("Welcome to AndroidHive.info");
alertDialog.setIcon(R.drawable.icon_smile);
alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getApplicationContext(), "You clicked on YES", Toast.LENGTH_SHORT).show();
}
});
alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getApplicationContext(), "You clicked on NO", Toast.LENGTH_SHORT).show();
}
});
alertDialog.show();
}
});
}
}


manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.alertdialogbox"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.alertdialogbox.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Wednesday, September 24, 2014

Quick Heal Technologies Recruitment 2014 for Technical

Quick Heal Technologies is hiring Software Test Engineers and Android Developers. It is a big opportunity for job seekers to get a job in very big and reputed organization.A good organization in Software and Security field.there are various posts for engineers. This is core Technical Software job.The joining will be given in Pune Location.Quick Heal Technologies is looking for Senior Test
Engineers and Senior Android Developers.
Quick Heal Technologies Pvt ltd is India’s leading provider of Internet Security tools and is a leader in Anti-virus Technology in India. It provide IT security for personal computing 

Education Qualification:-
For both Senior Android Developer and Senior Test Engineers:-
                 UG – B.Sc – Computers, B.Tech/ B.E. – Computers, BCA – Computers, PG – M.Tech – Computers,                     M.Sc – Computers, MCA – Computers

Key skills Senior Test Engineers:-
                    Cloud, Cloud Testing, JavaScript, Vb Scripting, C#, Python, QA, Performance Testing. Test Cases
Key skills Senior Android Developer:-
                    Android, Mobile Security, Android Antivirus, Java, Mobile Device Management, Mobile Antivirus

Experience Required:- 4-7 Years

Role :- Team Lead/ Technical Lead

Job description:-

Senior Test Engineers:-
Candidate with hands-on experience in QA, testing of cloud based enterprise applications, knowledge in SDLC, client server architect, scripting languages- Java, C#, VB, automation testing, database concepts & technologies like virtualization & cloud etc. Good in analytica, communication and presentation skills.

Senior Android Developer:-
Candidate expert in Android SDK, NDK, Java development tools, Android Studio, Eclipse or ADT, Java Programming, background in OOPs, UML, Object Oriented analysis & design. Knowledge in working on bug fixing and improving application performance, unit-test code for robustness, including edge cases, usability, and general reliability, functionally on Layouts, Activity, Intents, Services, design & build advanced applications for the Android platform. Experience in various code versioning systems such as Subversion or git. Good in team work & collaboration skills.

For more Details Please visit at:-www.quickheal.com

For Apply Online for Senior Test Engineer Please click here:-Apply
For Apply online for Senior Android Developer Please Click here:-Apply