Pages

Wednesday, March 20, 2013

Button

Project Name : Button
Application Name : Button
Package Name : com.demo.button
Activity Name : ButtonActivity


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"
    >
    <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</LinearLayout>

ButtonActivity.java


package com.demo.button;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class ButtonActivity extends Activity implements OnClickListener{

Button b;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
        b = (Button)findViewById(R.id.button1);
        b.setOnClickListener(this);
    }
@Override
public void onClick(View v) {
// TODO Auto-generated method stub

Toast.makeText(getApplicationContext(), "Button pressed..", 10).show();

}
}



Friday, March 15, 2013

Android Installation

1. Download and Install Java(jdk)  Download
2. Download and Open Eclipse  Download
3. Download and Install Android sdk Download
  A pop-up will come out just after you finished installing the SDK, which is the SDK manager. If no pop-up      window comes then you can manually open it from ‘All Program’

4.Download and Install ADT plugin for Eclipse
   Start Eclipse > Help > Install New Software....
   then click on Add top Right
   when Dialog appears enter "ADT" for the NAME  and following url for LOCATION

URL : https://dl-ssl.google.com/android/eclipse/

then OK

5. Config Android sdk

  select Window> Preferences..
  select Android from Left side ..
  after you may see dialog asking whether you wants to send usage statistics to Google..
  then click on Proceed
  for sdk location  click on Browse and locate your downloaded SDK directory...
 click Apply then OK
Get it on Google Play