Saturday, 12 April 2014

Today we are discussion about Option menu 


What is Option Menu in android ?

Option Menus are the primary menus of android. They can be used for settings, search, delete item etc.
Here, we are going to see two examples of option menus. First, the simple option menus and second, options menus with images.
Here, we are inflating the menu by calling the inflate() method of MenuInflater class. To perform event handling on menu items, you need to override onOptionsItemSelected() method of Activity class.



How to Create Option menu in Xml file with code ?



<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:showAsAction="never"
        android:title="@string/action_settings"/>
    <item android:id="@+id/item1" android:title="Call"></item>
    <item android:id="@+id/item2" android:title="MMS"></item>
    <item android:id="@+id/item3" android:title="Delete"></item>
</menu>

Java Code of Option menu


package com.rajnish.opetionmenu;

import com.example.opetionmenu.R;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

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;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case R.id.item1:
Intent in =new Intent(Intent.ACTION_CALL);
in.setData(Uri.parse("tel:121"));
startActivity(in);
Toast.makeText(getApplicationContext(), 
"Calling started", Toast.LENGTH_LONG).show();
return true;
case R.id.item2:
Toast.makeText(getApplicationContext(), 
"MMS Sending", Toast.LENGTH_LONG).show();
return true;
case R.id.item3:
Toast.makeText(getApplicationContext(), 
"Item Delete", Toast.LENGTH_LONG).show();
return true;
default:
// TODO Auto-generated method stub
return super.onOptionsItemSelected(item);
}
}
}





Friday, 11 April 2014

Download Android Developer Tools (ADT)


Android Development Tools (ADT) is a plugin for the Eclipse IDE that is designed to give you a powerful, integrated environment in which to build Android applications.
ADT extends the capabilities of Eclipse to let you quickly set up new Android projects, create an application UI, add packages based on the Android Framework API, debug your applications using the Android SDK tools, and even export signed (or unsigned) .apk files in order to distribute your application.
Developing in Eclipse with ADT is highly recommended and is the fastest way to get started. With the guided project setup it provides, as well as tools integration, custom XML editors, and debug output pane, ADT gives you an incredible boost in developing Android applications.
Download ADT

What is Android ?


WHAT IS ANDROID ?

Hello, today we are going to read about what is android.
Android is a operating system by google which is for mobile devices such as tablet computers, notebooks, smartphones, electronic book readers, set-top boxes etc.
It contains a linux-based Operating Systemmiddleware and key mobile applications.
It can be thought of as a mobile operating system. It is a OS which is not limited to mobile only. It is currently used in various devices such as mobiles, tablets, televisions, set-top box and cameras etc.

For more you can see this Video