Calendar Application

This example explains how to call and use system calendar into your application.

Algorithm:

1.)   Create a new project by File-> New -> Android Project name it CalendarApplication.

2.)   Write following into main.xml file:

&lt;?xml version=<em>"1.0"</em> encoding=<em>"utf-8"</em>?&gt;

&lt;LinearLayout xmlns:android=<em>"http://schemas.android.com/apk/res/android"</em>

android:layout_width=<em>"fill_parent"</em>

android:layout_height=<em>"fill_parent"</em>

android:orientation=<em>"vertical"</em> &gt;

&lt;Button

android:id=<em>"@+id/button1"</em>

android:layout_width=<em>"wrap_content"</em>

android:layout_height=<em>"wrap_content"</em>

android:onClick=<em>"onClick"</em>

android:text=<em>"Create Event"</em> /&gt;

&lt;Button

android:id=<em>"@+id/button2"</em>

android:layout_width=<em>"wrap_content"</em>

android:layout_height=<em>"wrap_content"</em>

android:onClick=<em>"queryCalendar"</em>

android:text=<em>"Query Calendar"</em> /&gt;

&lt;/LinearLayout&gt;

3.)   Put INTERNET permission to manifest file:

<uses-permission

android:name=“android.permission.READ_CALENDAR”>

</uses-permission>

<uses-permission

android:name=“android.permission.WRITE_CALENDAR”>

</uses-permission>

4.)   Run for output.

Steps:

1.) Create a project named CalendarApplication and set the information as stated in the image.

Build Target: Android 4.0

Application Name: CalendarApplication

Package Name: com. example. CalendarApplication

Activity Name: CalendarApplicationActivity

Min SDK Version: 14

2.) Open CalendarApplicationActivity.java file and write following code there:

<strong>package</strong> com.example.CalendarApplication;

<strong>import</strong> java.util.GregorianCalendar;

<strong>import</strong> android.app.Activity;

<strong>import</strong> android.content.ContentResolver;

<strong>import</strong> android.content.Intent;

<strong>import</strong> android.database.Cursor;

<strong>import</strong> android.net.Uri;

<strong>import</strong> android.os.Bundle;

<strong>import</strong> android.provider.CalendarContract;

<strong>import</strong> android.provider.CalendarContract.Calendars;

<strong>import</strong> android.provider.CalendarContract.Events;

<strong>import</strong> android.view.View;

<strong>import</strong> android.widget.Toast;

<strong>public</strong> <strong>class</strong> CalendarApplicationActivity  <strong>extends</strong> Activity {

<strong>public</strong> <strong>static</strong> <strong>final</strong> String[] <em>EVENT_PROJECTION</em> = <strong>new</strong> String[] {

Calendars.<em>_ID</em>, // 0

Calendars.<em>ACCOUNT_NAME</em>, // 1

Calendars.<em>CALENDAR_DISPLAY_NAME</em> // 2

};

<strong>private</strong> <strong>static</strong> <strong>final</strong> <strong>int</strong> <em>PROJECTION_DISPLAY_NAME_INDEX</em> = 2;

@Override

<strong>public</strong> <strong>void</strong> onCreate(Bundle savedInstanceState) {

<strong>super</strong>.onCreate(savedInstanceState);

setContentView(R.layout.<em>main</em>);

}

<strong>public</strong> <strong>void</strong> onClick(View view) {

Intent intent = <strong>new</strong> Intent(Intent.<em>ACTION_INSERT</em>);

intent.setType("vnd.android.cursor.item/event");

intent.putExtra(Events.<em>TITLE</em>, "Learn Android");

intent.putExtra(Events.<em>EVENT_LOCATION</em>, "Home suit home");

intent.putExtra(Events.<em>DESCRIPTION</em>, "Download Examples");

GregorianCalendar calDate = <strong>new</strong> GregorianCalendar(2012, 10, 02);

intent.putExtra(CalendarContract.<em>EXTRA_EVENT_BEGIN_TIME</em>,

calDate.getTimeInMillis());

intent.putExtra(CalendarContract.<em>EXTRA_EVENT_END_TIME</em>,

calDate.getTimeInMillis());

intent.putExtra(CalendarContract.<em>EXTRA_EVENT_ALL_DAY</em>, <strong>true</strong>);

intent.putExtra(Events.<em>RRULE</em>,

"FREQ=WEEKLY;COUNT=11;WKST=SU;BYDAY=TU,TH");

intent.putExtra(Events.<em>ACCESS_LEVEL</em>, Events.<em>ACCESS_PRIVATE</em>);

intent.putExtra(Events.<em>AVAILABILITY</em>, Events.<em>AVAILABILITY_BUSY</em>);

startActivity(intent);

}

<strong>public</strong> <strong>void</strong> queryCalendar(View view) {

Cursor cur = <strong>null</strong>;

ContentResolver cr = getContentResolver();

Uri uri = Calendars.<em>CONTENT_URI</em>;

String selection = "((" + Calendars.<em>ACCOUNT_NAME</em> + " = ?) AND ("

+ Calendars.<em>ACCOUNT_TYPE</em> + " = ?))";

String[] selectionArgs = <strong>new</strong> String[] { "Lars.Vogel@gmail.com",

"com.google" };

cur = cr.query(uri, <em>EVENT_PROJECTION</em>, selection, selectionArgs, <strong>null</strong>);

<strong>while</strong> (cur.moveToNext()) {

String displayName = <strong>null</strong>;

displayName = cur.getString(<em>PROJECTION_DISPLAY_NAME_INDEX</em>);

Toast.<em>makeText</em>(<strong>this</strong>, "Calendar " + displayName, Toast.<em>LENGTH_SHORT</em>)

.show();

}

}

}

3.) Compile and build the project.

Output

4.) If your phone doesn’t have any default calendar installed you will see the screen as below. Follow the instructions and see your calendar.

Posted in Android Application Development | Tagged , , , | Leave a comment

Google Android 4.0: Ice Cream Sandwich Comes With Some Amazing Features

Google android currently is a most well-known stand, as per varied survey company this Android tutorialsandroid mobile operating system turned into most common than apple iPhone smart phone. And still in frequently developing and that makes it different and that is the major valid reason for turning into so much widely used in short period of time. Google has launched android 3. 1, 3. 0, and 3. 2 honeycomb and even the gingerbread for smart phone. Last year company has declared about android 4. 0 that is also identified as ice cream sandwich, by that android has shake the complete smart phone market and people who are eager of utilizing smart phone they will definitely wait for this completely unique product.

The essential thing is after the announcement of this news is spreading like a wind all over the internet and folks are looking to buy it. And Google also says that by this latest version they will try to create the operating system that can run everywhere and so android 4. 0 was urbanized. After thriving in android based device the necessity of android app developer is also thriving on quick way.

Below stated are some of the significant options of android 4. 0

1) Multi-tasking Button

Android 4. 0 comes with a virtual button that makes it simple to browse and quickly switch to apps you recently used. The list exhibits thumbnail images of apps–instead of just icons–so you can observe which part of the apps are at present functioning in the background. And, if you choose to throw away or discard an item on the list, simply just flick the thumbnail so that you can remove it from the list.

2) Face Unlock

Now neglect to remember password, pin codes, and patterns. Android 4. 0 ice cream sandwich has customized phone unlocking quite easy, with most recently released aspect on unlocking the device, now your android tablet can find the owner face and by that it will unlock.

3) Multiple keyboard languages

Consumers that converse multiple languages will really enjoy this characteristic. You can now add multiple languages to the keyboard and easily switch between Latin-based input languages by swiping across the space bar. Not only does this results the keys but it influences the auto-correct dictionary as well.

4) Instant Screenshots with Button Press

There are lots of occasions in which users wish to share others what is right now exhibited on your screen. There are also times when they just need to save a screenshot for later use. In previous versions of Android tutorials, they could take screenshots by installing apps for that purpose. In Android 4. 0, it’s a built-in feature. By sustaining the Power and Volume Down buttons together, your Android smartphone lets you grab screen images promptly.

5) Data Usage Monitoring

The Android 4 OS originates with an in-built ability to observe the data usage of the phone. Phones users normally fear of their data usage. Data prices are high once your go beyond the data usage limit. The new OS monitor the level of data utilized displays it in a nice graphical format to the user. Users can add extra warning signals for excess data usage limits. Further, data usage for each application can be set in advance for managed mobile data usage.

6) Powerful voice input engine

Android 4. 0 initiates a amazing new voice input engine that offers you a frequent “open microphone” experience and streaming voice recognition. Now you can speak continuously for a longed time, even pause for intervals if needed and dictate punctuation to create correct sentences. As the voice input engine enters text, it shows underlines to possible dictation errors in gray. You can tap the underlined words to rapidly replace them from a list of solutions.

7) Copy and Paste

Copy and paste overall performance got a re-vamp and is much easier to use. You can now move around whole blocks of text.

This upgrade only shows how committed Google is to making Android the top mobile operating system. As you can see, there are countless superb new options in Ice Cream Sandwich that make it a top contender in the mobile and tablet market. This also illustrates that we can expect many more great new things from Android development in the near future.

Posted in Android Tutorials | Tagged , , , , | Leave a comment

Android Development Tutorial-TableLayout

Android Development Tutorial-TableLayout
7.1. Overview

In earlier chapter we have used the LinearLayout which allows to stack widgets vertical or horizontal. LinearLayout can be nestled to archive nice effects. This chapter will demonstrate the usage of “TableLayout”.

This layout allows to organize view into a table format. You specify via the view group “TableRow” rows for your table. Afterwards you put widgets into the individual rows.

On the “TableLayout” you can define which column should take additional space via the “android:stretchColumns” attribute. If several columns should take the available space you can specific them as a comma-separated list. Similar you can use the attribute “android:shrinkColumn”, which will try to word-wrap the content of the specified widgets and the attribute “android:collapseColums” to define initially hidden columns. Via Java you can display / hide these columns via the method setColumnVisible().

Columns will be automatically created based on the maximum number of widgets in one row. Per default each widgets creates a new column in the row. You can specific via “android:layout_column” the column a widget should go and via “android:layout_span” how many columns a widget should take.

You can also put non TableRows in a table. This way you can for example add dividers between your columns.
7.2. Example

Create the project “de.vogella.android.layout.table” with the activity “DemoTableLayout”. Change “main.xml” to the following.

< ?xml version=”1.0″ encoding=”utf-8″?>

android:orientation=”vertical” android:layout_width=”fill_parent”
android:layout_height=”fill_parent”>
android:id=”@+id/tableLayout1″ android:layout_height=”wrap_content”
android:stretchColumns=”1″>
android:layout_height=”wrap_content” android:id=”@+id/tableRow1″>
android:layout_width=”wrap_content” android:layout_height=”wrap_content”>
android:layout_width=”wrap_content” android:layout_height=”wrap_content”
android:layout_column=”2″>
android:layout_height=”4px” android:background=”#FF0000″> 

android:layout_height=”wrap_content”>
android:layout_width=”wrap_content” android:id=”@+id/editText3″>
android:layout_width=”wrap_content” android:text=”Field4″
android:id=”@+id/editText4″>

Change the activity “DemoTableLayout” to the following to use the button to hide the second column in the table.
This Android Tutorial has been taken from Vogella click the link to read the entire android development tutorial.

Posted in Android Tutorials | Tagged , , , , , , , , , , | Leave a comment

Android Tutorial and Android Development Course for Beginners

Taught by real teachers who guide you
through every topic step by step.

Our Android Tutorial Training System Is Proven & Guaranteed

Our course creators and instructors have worked on mobile apps and mobile gaming projects published by top tier companies such as EA Mobile, iPlay, Oberon Media, Disney Mobile, Sony Pictures, Warner Bros, and Vodafone amongst others. They have been actively involved for over 7 years in the mobile industry through our associated sister company Chakra Interactive.

Inside The Android Training Program You Will …

Master Android Development via a fun and easy to learn system

Learn step-by-step via Online Video Android Tutorials, PDFs and Worksheets

Get direct guidance and live One-on-One Support from our Tutors

Take Weekly Exercises that are then reviewed and graded for you

Have Tutors chart and monitor your progress on a regular basis

Learn from the comfort of your home, at the time of your convenience

Work on a live commercial project as part of your final project

Get an EDUmobile certification for the full tenure of the course

Once candidates complete our Android course they may go on to independantly create and publish their own Android Apps, or work as Freelancers taking on Android projects for Clients from sites like Elance and oDesk, or they can directly benefit from a higher pay having enhanced their technical skill sets in a cutting edge technology space.

How We Conduct The Android Tutorials & Course

Our experienced team of developers and tutors have created and refined the course based on a proven system that works and is recognized in the industry.

The course will train you via a step-by-step, fun and easy to learn methodology where our Tutors are available to you via live chat and email throughout the course.

The tutors are available to help you whenever you face a road block, or anytime you are stuck with understanding a conceptual problem or you face coding issues or you just simply need their guidance.

You are never charged any extra fees whatsoever, for any tutor support throughout the entire duration of the 8 week course.

” We confidently say (and our students testify this) that, there is simply no other Android Training Program or Off-the-shelf Book that can match our methodology, our highly organized course material, the online training videos, the weekly worksheets, the access to live projects and the level of one-on-one support that is available throughout the term of the course.”

[1] Online Video Training – Once a Week. Delivered via broadband or DVD / CD via postal mail.

[2] One-on-One Interactive Online Support – Get 24 hour access by posting your issues and get help from our expert tutors quickly.

[3] Weekly PDFs and Worksheets – Read material and practice real problems and assignments as you go along.

[4] Live Industrial Project – One to two Live projects, with a choice to distribute the developed properties through various channels, and earn money.

[5] 24 x 7 Forum Access – Come to the members only online forum to meet other developers and discuss ideas and coding issues.

[6] EDUmobile Certification – Get a Certificate at the end of the course from EDUmobile – a recognized entity in the wireless industry.

[7] Access The Source Code Repository – Access and download over 100 valuable Source Code snippets that you can use freely in any of your projects for life.

[8] DVD & CD by mail* – At the end of the course, on request, we will send you all the content including bonus materials by postal mail.

LIMITED SEATS AVAILABLE – Sign Up at EDUmobile.ORG Android Development Course Today!

 

 


Posted in Android Tutorials | Tagged , , , , | Leave a comment

Android Tutorial-Making a custom Android button using a custom view

Android Tutorial-Making a custom Android button using a custom view

Creating a custom view is as simple as inheriting from the View class and overriding the methods that need to be overridden. In this example, a custom button is implemented in this way. The button shall feature a labelled image (i.e. an image with text underneath).

1 public class CustomImageButton extends View {
2 private final static int WIDTH_PADDING = 8;
3 private final static int HEIGHT_PADDING = 10;
4 private final String label;
5 private final int imageResId;
6 private final Bitmap image;
7 private final InternalListener listenerAdapter = new InternalListener();
8

The constructor can take in the parameters to set the button image and label.


9 /**
10 * Constructor.
11 *
12 * @param context
13 *        Activity context in which the button view is being placed for.
14 *
15 * @param resImage
16 *        Image to put on the button. This image should have been placed
17 *        in the drawable resources directory.
18 *
19 * @param label
20 *        The text label to display for the custom button.
21 */
22 public CustomImageButton(Context context, int resImage, String label)
23 {
24 super(context);
25 this.label = label;
26 this.imageResId = resImage;
27 this.image = BitmapFactory.decodeResource(context.getResources(),
28 imageResId);
29
30 setFocusable(true);
31 setBackgroundColor(Color.WHITE);
32
33 setOnClickListener(listenerAdapter);
34 setClickable(true);
35 }
36

With the constructor defined, there are a number of methods in the View class that needs to be overridden to this view behave like a button. Firstly, the onFocusChanged gets triggered when the focus moves onto or off the view. In the case of our custom button, we want the button to be “highlighted” when ever the focus is on the button.

This android tutorial to create and android button has been taken from the android development

tutorial by androidcore click the link to read the rest of the android tutorial

learn android programming

Posted in Android Tutorials | Tagged , , , , , , , , , | Leave a comment

Android App Development – Some Basic Tips For Android Application Development.

Android is a mobile software platform. It is an operating system too. It is designed based upon Linux Kernel. It is developed by Google and the Open Handset Alliance. Being an opensource platform there is no license fees so it reduces the initial investment of the project owner.

Android apps Development

In the era of mobile technology, Android has been showing its enormous presence attracting, both, users and Android application developers. Since its release in 2007, we have found Android’s prospects in developing quality mobile applications. Whenever Google releases new versions of Android SDK, multiple new features are added to compete in the mobile technology world.

 

Android has various characteristics to produce revolutionary mobile applications.

* To send and receive data across mobile platform Android uses various technologies like GSM, EDGE, CDMA, Bluetooth, Wi-Fi, EV-DO, and UMTS

* SQ-Lite for data storage

* Android has wide range of libraries for image, video and audio files like MPEG4, H.263, H.264, AMR, AMR-WB, MP3, AAC, JPG, BMP, GIF, PNG, WAV, and MIDI formats.

* It has comprehensive libraries for 2d and 3d graphics

* It has Inter-Process Communication (IPC) message passing facilities

* You can use Google talk for P2P communication

* It has features for video camera, touch screens, GPS, accelerometer, and magnetometer.

Android has SDK which provides tools and libraries for Android app development. With its SDK a developer can design the UI for an application and debug it as well.

The SDK includes multiple versions of Android platform (For example, Android 1.1, and Android 1.5) that you can use for Android Application Development. For every version, the SDK offers a fully compliant Android library and system image.

Android apps Development

Android SDK includes some core applications:

 

* An e-mail client compatible with Gmail

* An SMS program

* A Personal Information Management (PIM) program including a calendar and contact list

* A Google Map Application

* A web browser

* A music player

* A picture viewer

* The Android Marketplace client to download third-party application

* The Amazon MP3 store client to purchase DRM free music

Android Application Development is based on four basic elements:

* Activities: A UI component that corresponds to display screens. Each activity displays one screen to the user. When the activity is not running, the operating system can kill it to save memory space.

* Broadcast Receiver: Is a reaction to an event. For example, phone ringing.

* Services: The tasks that run in the background. For example, an MP3 players running in the background while the user has gone to use other application on mobile device.

* Content Provider: Shares data with other activities and services.
source android tutorial

Posted in Android Tutorials | Tagged , , , , , , , , , , | Leave a comment

Few steps which can make your Android phone experience better.

android developmentAndroid is known as to be one of the best application development programs in our mobile world. Without any doubt, android phones can satisfy and compete with other development programs which includes Blackberry, iPhone and other such Smartphones. Many handsets use a Android platform today, and mainly because of the wide range of applications in the android market, there is so much of competition for an android platform. There five tips are a good place for users to get started in making the most out of their phone, how to make android apps work better. They work on the HTC EVO 4G, but should work on most Android phones, too.

Following are the five steps to make android phones better
Amazon MP3. Twitter buddy @geekaren in recent times remarked that the Amazon MP3 app, an effective interface with Amazon’s music service, gives a free MP3 regularly. The song is exhibited upon the main screen in the app, and downloading the free song just requires a couple of taps. These MP3s are free of DRM and immediately after mere seconds to download appear in the Android music app. The songs are wonderful, handle numerous genres and so are an easy way to produce a music library on Android phones. Amazon offers an inexpensive album deal of the day, which is found next to the free song. The Amazon MP3 app is pre-installed on most Android phones, and it is available in the Android Market for those phones shipping without it.

Volume Control app. Android gives total command over all facets of the phone’s audio, but obtaining it is not as common as it ought to be. The free Volume Control app features a single screen where all six volume controls are often adjusted with sliders. Yes, Android permits individual volume options for system sounds, phone ringer, notifications, call volume, media playing and alarms. The Volume Control app also contains audio profile changes via four buttons at the bottom of the screen, which makes it a breeze to switch the phone to silent or vibrate mode by using a single tap.

Bookmark Sorting. The Android web browser undoubtedly wonderful, full-featured, mobile browser with the ability to deal with many bookmarks, and it is one of the reasons the platform has grew so instantly. These bookmarks generally is a way to obtain frustration at times, because so many Android phones present them to the consumer in the order by which they’re preserved on the phone, instead of displaying oft-visited sites at the top of the list since many clients choose. An absolutely free app, Bookmark Manager, handles this issue effortlessly.

This unique app features a summary of latest bookmarks that has changed in different desirable order. Within a few moments even large lists might be structured in any fashion. The beauty of using this method is that the web browser and the majority of bookmark icons displaying bookmarks on the home screens, immediately adjust to present bookmarks in the different order.


Switch off SMS Notifications
. The handling of text messages isn’t bad on Android phones, most persons use third-party apps that incorporate elements which includes group messaging. My personal favorite is Handcent SMS, however even if these apps add certain functionality, using them tends to make an issue that frustrate many users. Anytime a text message is received, Android sends a notice to the system status bar. Whenever a third-party app is being utilized in place of the conventional Android fare, two notifications appear, one for each app, and even though the message is read in one app, thenotice for the other app still implies an unread message.

There is a fairly easy fix for the duplicate notification: Start the standard messaging app and enter in the settings. Get the setting for notification in the status bar and power it down. The third-party app will still notify you when a message is received, but the standard Android app won’t. This sounds obvious, but how to get rid of the duplicate notifications is amongst the questions I get asked normally.

Multicon edit mode. The free Multicon widget makes it possible to include four icons to the Android home screen within the space usually committed to just one. It is actually probably the most beneficial widgets in the Android Market. As soon as you frequently alter the content material on your home screens as I do, the capability to update the multiple icons designated to Multicon meant deleting all of them and redoing them from scratch each time. Not anymore, as current versions of Multicon offer an edit mode that enables alterations to be produced on the fly.

To create upgrading the icons easy, add a Multicon to one of the home screens with the Edit Mode designated to an icon slot. Tapping the Edit Mode icon then alterations all cases of Multicon widgets in a simple edit mode; once in edit mode, choose the app icon no longer desired and change it out to something else. It is effortless alter your home screens on a whim with this particular method.

Posted in Android Tutorials | Tagged , , , | 1 Comment

Top 10 Best Android Apps of the week 2011 must have v2.2

Best android apps of the week March 7, 2011-

[youtube]http://www.youtube.com/watch?v=XMvJ7ZjlTqY[/youtube]

Posted in Uncategorized | Tagged , , , | Leave a comment

Android Tutorial: Using the Menu Button

Android Tutorial: Using the Menu Button

[youtube]http://www.youtube.com/watch?v=6UYNnQOxCS8[/youtube]

Josh Beck-Technology teacher an Antonia Texas
This tutorial is designed as a review for my 8th grade
programming class. In this tutorial I discuss how
to make the ‘menu’ button work on Android.

Posted in Android Tutorials | Tagged , , , , , , , , , , | Leave a comment

Android Tutorial 1 – Setup

Android Tutorial 1 – Setup
n this episode, I go through Unity 3.1.04f’s way of setting up an android device for Unity Android Development, as well as some basics.

[youtube]http://www.youtube.com/watch?v=JbBkWsQKKyE[/youtube]

Posted in Android Tutorials | Tagged , , , , , , , | Leave a comment