Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

how to Display a Dialog Window Using an Activity ? - Android Tutorial


hey guys, to day i am going to give you a fresh tutorial on android. as many people wants a dialog window in their Android apps.

To Display a dialog window, you must be familiar with basic android coding functionality!

android tutorial
1 . Using Eclipse, create a new Android project and name it Dialog. 
2 . Add the following statements in bold to the main.xml file:
version=”1.0” encoding=”utf-8”?> 
”http://schemas.android.com/apk/res/android”

android:orientation=”vertical”

android:layout_width=”fill_parent”

android:layout_height=”fill_parent” > < span="">

android:layout_width=”fill_parent”

android:layout_height=”wrap_content”

android:text=”@string/hello” />

span="">

android:id=”@+id/btn_dialog”

android:layout_width=”fill_parent”

android:layout_height=”wrap_content”

android:text=”Click to display a dialog” />

3 .        3 . Add the following statements in bold to the MainActivity.java file: package net.learn2develop.Dialog;

import android.app.Activity; import android.os.Bundle; import android.app.AlertDialog; import android.app.Dialog;

import android.content.DialogInterface; import android.view.View;

import android.widget.Button; import android.widget.Toast;

public class MainActivity extends Activity {

CharSequence[] items = { “Google”, “Apple”, “Microsoft” };

boolean[] itemsChecked = new boolean [items.length];

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

        setContentView(R.layout.main);

Button btn = (Button) findViewById(R.id.btn_dialog);

btn.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {

showDialog(0);

}

});

    }

@Override

protected Dialog onCreateDialog(int id) {

switch (id) {

case 0:

return new AlertDialog.Builder(this)

.setIcon(R.drawable.icon)

.setTitle(“This is a dialog with some simple text...”)

.setPositiveButton(“OK”, new

DialogInterface.OnClickListener() {

public void onClick(DialogInterface dialog,

int whichButton)

{

Toast.makeText(getBaseContext(),

“OK clicked!”, Toast.LENGTH_SHORT).show();

}

})

.setNegativeButton(“Cancel”, new

DialogInterface.OnClickListener() {

public void onClick(DialogInterface dialog,

int whichButton)

{

Toast.makeText(getBaseContext(),

“Cancel clicked!”, Toast.LENGTH_SHORT).show();

}

})

3 . 

4 . Press F11 to debug the application on the Android Emulator. Click the button to display the dialog. Checking the various checkboxes will cause the Toast class to display the text of the item checked/unchecked. To dismiss the dialog, click the OK or Cancel button.
how to Display a Dialog Window Using an Activity ?

Architecture of Android OS


In order to understand how Android works, take a look at Figure below, which shows the various layers that make up the Android operating system (OS).

Architecture of Android
  • Linux kernel — This is the kernel on which Android is based. This layer contains all the low level device drivers for the various hardware components of an Android device.

  • Libraries — These contain all the code that provides the main features of an Android OS. For example, the SQLite library provides database support so that an application can use it for data storage. The WebKit library provides functionalities for web browsing.
  • Android run time — At the same layer as the libraries, the Android run-time provides a set of core libraries that enable developers to write Android apps using the Java programming language. The

Architecture of Android
  • Android run-time also includes the Dalvik virtual machine, which enables every Android application to run in its own process, with its own instance of the Dalvik virtual machine (Android applications are compiled into the Dalvik executables). Dalvik is a specialized virtual machine designed specifically for Android and optimized for battery-powered mobile devices with limited memory and CPU.

  • Application framework — Exposes the various capabilities of the Android OS to application developers so that they can make use of them in their applications.

  • Applications — At this top layer, you will find applications that ship with the Android device (such as Phone, Contacts, Browser, etc.), as well as applications that you download and install from the Android Market. Any applications that you write are located at this layer.

Rich snippets For Application on Google


After Giving some big changes in Google Search, (i.e expanding site links, New Search Design), Once Again Google comes with some new changes, that is very appreciative, i must say!


Now You can see a Rich snippets for application while you search on Google for any application (i.e Android Market). so now those user who looking for better application, they do not need to go on page and check about it, Google search only enough to give review and little information, cost of the application, and much more about the application.


For Example, when i was searching for "Dropbox" application for Andorid, the following snippets was displayed.


dropbox search on google
Where you can see, User Review, How Many User using this application, And also the cost of the application, and the small description of the application is displayed only in search results!


Rich snippets help users determine more quickly if a particular web page has the information they're interested in. Google has previously introduced rich snippets for shopping, recipes, reviews, video, and events, and most recently music.


Rich snippets for the application can available for several marketplaces and review sites, including Android Market, Apple iTunes, and CNET.


For more info. check Google official Blog Here.

Juice Defender - Battery Saving Application [Android Users]


Juice DefenderHaving an Android phone is every one's desire and Using it is status symbol now days. Many of us using Smart phone on regular basis,but its very Difficult to fight with Battery power while using Smart-phone. As downloading and using so many application,Games give a nice feel but the problem of Battery loss is faced by almost all Smart phone user. It happens Because of Multi-tasking facilities of smart phone,when you switch to one application to another,in smart phone its just Hide the older application inseted of Terminate it. To avoid such Battery loss, We suggest you awesome Application that help you to save your battery power, Juice defender.

 
Juice Defender, A Battery manger application, that provides you the facility to extends your phone's battery life by intelligently and transparently managing the most power-draining components of your Android device, like 3G/4G connectivity and WiFi. The most Fabulous thing about juice defender is that it runs by itself for improving battery life from behind the scenes, and it optimizes your power consumption and give you extra hours of precious battery life.


Juice DefenderJuice defender gives other useful feature like :
  • 5 preset profiles (from default mode to full customization)
  • Easy and intuitive user interface
  • Totally ads free!
  • 2 home screen widgets
  • mobile data toggle automation
  • 2G/3G toggle automation
  • WiFi toggle automation + auto-disabling option
  • location-aware WiFi control
  • battery consumption optimization
  • comprehensive connectivity scheduling (regular schedule, night time/peak time, week days/weekends)
  • connectivity control for specific apps
  • CPU scaling when phone is idle
  • full activity log

And Its Free!! Download it now!!

India Against Corruption, now on Android Market [app]


The "talk of the town" in India, India Against Corruption (IAC) now has an Android application and a Symbian app, to help spread awareness about the movement.  India against corruption, application runs on all Android devices running OS version of 1.6 or up. IAC application has latest news, streaming videos, polls, volunteer registration, latest about Lokpal and few other features. Looks like the application was developed in a record time and is also much needed to spread the word. India Against Corruption (IAC), has already released a Twitter app.


There is one more application called "Lokpal messenger", developed for Nokia phones by two Sastra University [Tamilnadu, India] students. 

Both Lokpal Messenger and IAC are available in the Nokia Ovi store. IAC Android application link  Click to Download Now!



There is no need but probabl This Application will help to accelerate this Movement against Corruption in india.






image and credit to Thegadgetfan.com

History of Android [INFOGRAPHIC]


Mobile app developers [x]cubelabs have laid out a timeline of these versions — from Cupcake to Ice Cream Sandwich — in the infographic below.




Android SDK - Installation and Startup Guide


Android logo
Ultimate guide to install Android SDK!

Android - A robot with a human appearance. A open source robot that any one,even you can make your own application with android for you or for million of Android user.yeah! So, starting with Basic terminology [installation] of android SDK.



How to install Android SDK on Computer?


well its even easy to install Andorid SDK on computer. Here is 6 simple Steps you can follow for intallation of Andorid SDK.

1st Step...

Download and Install the Android SDK.

a. Download the Android SDK  [ Right now its available for major OS like Windows,MAC and Linux].
b. Install/Extract the downloaded SDK.
c. Go to the directory where you installed the SDK [i.e C:\] and open SDK Manager to open Android SDK and AVD Manager.
d. In AVD manager under Available Packages you can see different versions of SDK’s.
e. Select SDK Platform tools and one of the version of SDK and click on install.

2nd Step...

Downloading Eclipse Software


Although there are lot of IDE out there Eclipse is recommended IDE which will give you best support for Android app development.



3rd Step...

Installing Android Development Toolkit [ADT] plug-in.


a. Open Eclipse s/w and under Help -> Install New Software…


b. Now you will see a window which allows you to install new plug-in.


c. Click on Add button and in Name and in Location give the link https://dl-ssl.google.com/android/eclipse/ and proceed with further steps. You can see window like below:
click on image to enralge

4th Step...

click on image to enralge
Creating Sample Project android project involves very few steps:


a. In your Eclipse IDE go to File and Android Project.

b. Give Project Name, Select Build Target, Application Name, Package Name, Activity Name, Min SDK version and click Finish. 

c. Now you can see bunch of files created in the project explorer.

For Example like this side image-:
5th Step...

Creating New Android Virtual Device [AVD]

The AVD is an emulator which provides you android hardware and software environment to test application on computer.

click on image to enralge

a. In Eclipse open SDK Manager under Windows and Android SDK and AVD Manager.
b. Click on New on the right side. [Like this side image show]
c. Give Name, Select Target give SD Card size and click on Create AVD.
d. Now a new AVD is created with the specification you provided and Close the Android SDK and AVD Manager.

6th Step...

How to RUN the Project?


a. Right Click on the project in Package Explore and click on Run As -> Android Application.

click on image to enralge

b. Now you can see an AVD is opened and booting up. [It might take much time to launch AVD for the first time].

c. Once the AVD started you can see the output on the AVD screen.

Thats It!! Easy? hope this post Help you to your 1st installation of Android SDK.

ALL THE BEST!!!

[Android logo from Android.com]