Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts

Wednesday, February 4, 2015

Android beginner tutorial Part 62 Notification

Today well learn how to use a system service to create Notifications.

A Notification is a note that appears in the top of the screen, has an icon, a title and a descrition text.

Go to the activity_main.xml layout and create 2 buttons - one to start a notification and one to update it.

<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity" >

<Button android:id="@+id/notifyButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Start notification"
/>

<Button android:id="@+id/updateButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Update notification"
/>

</LinearLayout>

Go to MainActivity class and declare 4 variables - an identificator for the notification, a NotificationManager instance, a NotificationCompay.Builder instance and an Intent instance.

private static final int NOTIFY_ID = 101;
private NotificationManager notificationManager;
private NotificationCompat.Builder nbuilder;
private Intent resultIntent;

In the onCreate() function, set notificationManager to refer to a system service that manages notifications. Do that using the getSystemService() method as shown below:

notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

Now set the nbuilder to a new NotificationCompat.Builder() object. This will let us build our notification later:

nbuilder = new NotificationCompat.Builder(MainActivity.this);

Now set the Intent instance to an Intent that would be used when the user taps the Notification. I will direct it to a SecondActivity class:

resultIntent = new Intent(MainActivity.this, SecondActivity.class);

Now add a click listener to the notifyButton button. In the onClick() function, set the icon, title and text of our notification using nbuilders setSmallIcon(), setContentTitle() and setContentText() methods.

After that, we declare a TaskStackBuilder instance. Basically it is a Stack that we artificially create in order to get a PendingIntent instance, which is then passed to the builder via its setContentIntent() method.

Then we use the notify() method of the notificationManager object to show the notification.

final Button notifybtn = (Button)findViewById(R.id.notifyButton);
notifybtn.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
nbuilder.setSmallIcon(R.drawable.snowflake);
nbuilder.setContentTitle("Notification!");
nbuilder.setContentText("Hello world!");

TaskStackBuilder stackBuilder = TaskStackBuilder.create(MainActivity.this);
stackBuilder.addParentStack(SecondActivity.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

nbuilder.setContentIntent(resultPendingIntent);
notificationManager.notify(NOTIFY_ID, nbuilder.build());
}
});

To update the notification, do whatever you need with the builder and then call the notify() function again. It is important to keep the same ID in order to update an existing notification:

final Button updatebtn = (Button)findViewById(R.id.updateButton);
updatebtn.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
nbuilder.setContentText("Updated message at " + new Date().toString());
notificationManager.notify(NOTIFY_ID, nbuilder.build());
}
});

Full code:

package com.kircode.codeforfood_test;

import java.util.Date;

import android.app.Activity;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity{

private static final int NOTIFY_ID = 101;
private NotificationManager notificationManager;
private NotificationCompat.Builder nbuilder;
private Intent resultIntent;

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

notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nbuilder = new NotificationCompat.Builder(MainActivity.this);
resultIntent = new Intent(MainActivity.this, SecondActivity.class);

final Button notifybtn = (Button)findViewById(R.id.notifyButton);
notifybtn.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
nbuilder.setSmallIcon(R.drawable.snowflake);
nbuilder.setContentTitle("Notification!");
nbuilder.setContentText("Hello world!");

TaskStackBuilder stackBuilder = TaskStackBuilder.create(MainActivity.this);
stackBuilder.addParentStack(SecondActivity.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

nbuilder.setContentIntent(resultPendingIntent);
notificationManager.notify(NOTIFY_ID, nbuilder.build());
}
});

final Button updatebtn = (Button)findViewById(R.id.updateButton);
updatebtn.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
nbuilder.setContentText("Updated message at " + new Date().toString());
notificationManager.notify(NOTIFY_ID, nbuilder.build());
}
});
}

}

Now lets go to the second activity. Open its layout file activity_second.xml, add a button that kills the notification:

<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity" >

<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="32sp"
android:text="Second Activity"
/>

<Button android:id="@+id/killButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Kill notification"
/>

</LinearLayout>

In the SecondActivity.java class add a click listener that removes the notification using the cancel() method of the notification manager:

package com.kircode.codeforfood_test;

import android.app.Activity;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class SecondActivity extends Activity{

private static final int NOTIFY_ID = 101;

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

final Button killbtn = (Button)findViewById(R.id.killButton);
killbtn.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(NOTIFY_ID);
}
});
}

}

It is also possible to cancel all the notifications youve called using cancelAll().

You can also use setAutoCancel() method of the NotificationCompat.Builder object to make the notification kill itself when its selected.

Thanks for reading!

Tuesday, February 3, 2015

Android beginner tutorial Part 13 Scrolling content

In this tutorial we will learn how to implement scrolling.

The TextView class uses its own scrolling system and it doesnt need any additional scrolling functionality, but adding visible scroll bars to TextView objects improve the visual look of the application and usability.

There are two container classes that are used to add scroll bars. These are ScrollView and HorizontalScrollView. Note that the ScrollView class only provides a vertical scroll bar. To use both, include the HorizontalScrollView container inside the ScrollView container.

It should be noted that both of these classes are subclasses of the FrameLayout class. This means that these objects can only contain 1 child. Usually this child is a LinearLayout with items stacked horizontally or vertically.

Lets create a simple example that displays a TextView with a large piece of text and make it scrollable.

First, open the strings.xml file and add a "textLorem" object which contains a huge portion of Lorem ipsum text.

<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">Code For Food Test</string>
<string name="textLorem">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sit amet metus eu lacus faucibus facilisis in ac odio. Maecenas magna ipsum, hendrerit vel pulvinar eget, posuere et arcu. Phasellus semper mollis vestibulum. Mauris nec felis lorem, at porta tellus. Vestibulum vel leo mi, id consequat sem. In hac habitasse platea dictumst. Praesent suscipit auctor tellus quis condimentum. Morbi id sem id justo vestibulum consectetur. Aliquam leo nisl, tempus quis feugiat at, varius a sem. Proin nulla augue, scelerisque eu rutrum sit amet, aliquam eu leo. Nullam justo mauris, tristique quis condimentum in, sagittis a massa.</string>
<string name="menu_settings">Settings</string>

</resources>

Now go to activity_main.xml and use this code:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:context=".MainActivity" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/textLorem"
android:textSize="24sp"/>

</ScrollView>

Test this on an emulator or a device and you will see that the text is vertically scrollable.

You can add multiple elements this way:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:context=".MainActivity" >

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="A button"
/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/textLorem"
android:textSize="24sp"/>

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Another button"
/>

</LinearLayout>

</ScrollView>

That is all there is to it!

Thanks for reading.

Monday, February 2, 2015

Android beginner tutorial Part 20 ImageButton widget

Today well learn about the ImageButton widget.

The ImageButton component is similar to a regular Button, with the only exception that instead of text, it displays an image. If you havent already read one of my earlier tutorials about ImageView class, do so, because in this tutorial we will be working with drawable resources.

Lets start writing our example application right away - go to activity_main.xml layout file and create a simple layout with an ImageButton inside of it. Use its android:src attribute to set the image source:

<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity" >

<ImageButton android:id="@+id/myButton"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:src="@drawable/snowflake"
/>

</LinearLayout>

I should note that in this tutorial Im using 2 images - snowflake.png and snowflake2.png, which is basically a recolored version of the original snowflake.

Go to MainActivity.java class now and create an Activity class that does the following things:

1. Declare 2 variables - "button" ImageButton and "toggle" boolean.
2. Set "toggle" to true in the onCreate() function.
3. Set "button" to our existing ImageButton in the layout xml.
4. Add a click listener to the button, which sets the image source of the button based on the "toggle" boolean value, also change the value of the "toggle" boolean to opposite.

Use the setImageResource() method to set image source dynamically.

Heres the code:

package com.kircode.codeforfood_test;

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

public class MainActivity extends Activity{

public ImageButton button;
private boolean toggle;

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

toggle = true;

button = (ImageButton)findViewById(R.id.myButton);
button.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
if(toggle){
button.setImageResource(R.drawable.snowflake2);
}else{
button.setImageResource(R.drawable.snowflake);
}
toggle = !toggle;
}
});
}

@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;
}

}

If you run your application now on a device or an emulator, youll see that you can press the button to toggle the image. Heres what my application looks like (2 screenshots of what the button looks like before and after clicking it):



Thanks for reading!

Thursday, January 29, 2015

Archos 7d g3 Rockchip Rk3066 flashing tips tutorial firmware and spec

Archos Arnova 7d g3 

Flashing Tips,Tutorials,Firmware



tabletrom.blogspot.com
Logo is property of  Respective Owners. 


Wiki

Read article about Rockchip CPU on Wikipedia 




Specifications 


Brand : Archos 
Model Arnova 7d


LCD                
7 inch Capacitive multi touch  Screen
Screen Resolution 
800 x 480 Pix
Processor 
 1.0GHz
Chipset / Boxchip
RK3066
RAM
1 GB
Built in Memory
8 GB
External Memory
Support Micro Card  (upto 16 GB)
Wifi
802.11 b/g/n  supported
Bluetooth
n/a
Sim
n/a
Camera
           front                                 
HDMI /3g Dongle
 Support 3G Dongle
Microphone
Built IN 
Weight
300 g
Android Version
4.1

Knowledge base :

What board ID , Tablet CPU Chip ,Firmware Number does my Tablet have ? 
Frequently Asked Question about Android Tablets 

When I need to Restore or Reset  my Android Tablet Pc?


1. Forgotten Pattern Lock . 
2.Too many pattern attempts / Reset user lock.
3.  Tablets PC stuck on Gmail account.
4. Android Tablets PC stuck on Android logo.
5. Tablet Android  hang on start up / Multiple errors generating by OS. 
6. Android Market  having problems or generating errors. 
7.Upgrading to new Android OS.
Instructions: 

you can use this Android Tablet firmware,  Stock ROM to restore your Android China tablets to generic firmwares or upgrades . Make sure to charge battery . Power failure during flashing may result dead or broken tablets.
.
Note : Flashing generic tablet firmware should be last option.

Flashing Tutorials :


Read Before : Flashing Tutorial for Rockchip 
Download Flashing Instructions : PDF
SD Card Flashing Too : Tutorial and Tool

Drivers for Rockchip:



Download Drivers for Rockchip tablets


Flashing Tools:


Download: RKbatch Tool

Recommended  Tools:

you can also use:Android Tools for Rockchip Tablets

How to download Firmware 

To download official ,rooted or custom firmware you need to visit the official web and developers web  www.rockchipfirmware.com .You can contact with developer in case of firmware trouble or can comment on this blog. 





Saturday, January 24, 2015

Flash AS3 Volume Control Tutorial

Exercise Files:
Adjusting_Volume_Start.fla
CheerfulSong.mp3

NOTE: Be sure to save both files in the same folder.

To adjust sound volume in Flash, you will need a SoundTransform object. The SoundTransform class has a volume property, which you can assign a value from 0 - 1. Where 0 is mute, and 1 is full volume.

For example:
var volumeAdjust:SoundTransform = new SoundTransform();
volumeAdjust.volume = .5;
The first line creates a SoundTransform object named volumeAdjust. The next line sets the volume property to .5.

But this doesnt adjust the volume of the sound just yet. Yes, weve set a new volume level, but we still havent applied it to any sound. So after creating the SoundTransform object and setting the volume level, we must then apply the SoundTransform object to a specific SoundChannel. You can do this using the soundTransform property of the SoundChannel class.

NOTE: Be aware of the distinction between a SoundTransform object (which would be an instance of the SoundTransform class) and the soundTransform property (which is a property of the SoundChannel class). A SoundTransform object is what holds the value for the volume level adjustment, where as the soundTransform property of the SoundChannel class is used in order to apply that volume level adjustment to the sound. Also notice that the soundTransform property starts with a lowercase s, while the SoundTransform class starts with an uppercase S.

Example:
// Assume that channel1 is a SoundChannel object and that there is
// already a sound assigned to that channel
channel1.soundTransform = volumeAdjust;
This statement assigns the SoundTransform object named volumeAdjust, to the soundTransform property of the SoundChannel object named channel1. So this means that whatever sound is being played on that SoundChannel will have the volume adjustment applied to it.

NOTE: The volume property can actually accept values that are greater than 1, as well as negative values. But generally, you should only allow values between 0 - 1 (nothing greater nothing less) because values outside that range can end up distorting the sound. Negative values will actually increase the volume as well. So if the volume property has a value that goes below 0, the sound volume comes back up. You can use an if statement with an else clause in order to set constraints (which we will do later on).

So lets begin.

Open the exercise file and select the first frame of the Actions layer. In the Actions Panel, youll see that theres already some code:
var mySound:Sound = new Sound();
var songURL:URLRequest = new URLRequest("CheerfulSong.mp3");
var channel1:SoundChannel = new SoundChannel();

mySound.load(songURL);

play_btn.addEventListener(MouseEvent.CLICK, playSound);
stop_btn.addEventListener(MouseEvent.CLICK, stopSound);

function playSound(e:MouseEvent):void
{
channel1 = mySound.play();
}

function stopSound(e:MouseEvent):void
{
channel1.stop();
}
This code just loads the sound and creates the playing and stopping functionality. We will just be adding the volume controls.

On the stage, you will see two small buttons: one pointing up (volUp_btn) and one pointing down (volDown_btn). These buttons will be made clickable in order to adjust the volume.

But first, lets go ahead an create the SoundTransform object. I will name it volumeAdjust:
var mySound:Sound = new Sound();
var songURL:URLRequest = new URLRequest("CheerfulSong.mp3");
var channel1:SoundChannel = new SoundChannel();
var volumeAdjust:SoundTransform = new SoundTransform();

mySound.load(songURL);

Next, lets go ahead and create the event handlers for the volume buttons. I will name the listener functions volUp (for increasing the volume) and volDown (for decreasing the volume):
play_btn.addEventListener(MouseEvent.CLICK, playSound);
stop_btn.addEventListener(MouseEvent.CLICK, stopSound);
volUp_btn.addEventListener(MouseEvent.CLICK, volUp);
volDown_btn.addEventListener(MouseEvent.CLICK, volDown);

function playSound(e:MouseEvent):void
{
channel1 = mySound.play();
}

function stopSound(e:MouseEvent):void
{
channel1.stop();
}

function volUp(e:MouseEvent):void
{

//code to increase the volume goes here
}

function volDown(e:MouseEvent):void
{

//code to decrease the volume goes here
}

Next, lets set the initial volume.

Set the volume property of the SoundTransform object to the desired level. I will give it a value of .5:
var mySound:Sound = new Sound();
var songURL:URLRequest = new URLRequest("CheerfulSong.mp3");
var channel1:SoundChannel = new SoundChannel();
var volumeAdjust:SoundTransform = new SoundTransform();

volumeAdjust.volume = .5;
Then go to the playSound function (thats the listener function thats called whenever the play button is clicked) and add the following line (highlighted in bold):
function playSound(e:MouseEvent):void 
{
channel1 = mySound.play();
channel1.soundTransform = volumeAdjust;
}
Code explained:
volumeAdjust.volume = .5;
This line sets the volume property of the SoundTransform object to .5 (which is at half the full volume level).

channel1.soundTransform = volumeAdjust;
Then to apply the change in volume, the volumeAdjust SoundTransform object is assigned to the soundTransform property of channel1. Its important to note that this line must be added after the play sound statement is assigned to the SoundChannel object. Otherwise, the volume change will not be applied.

So now, weve set the initial volume to .5. Test the movie and try applying different volume levels in order to hear the difference. Try putting in a value greater than 1 (around 15-20, for example) and you will notice some sound distortion (be sure to keep your ears a comfortable distance away from the sound source when you do this). Then make sure you bring it back down to .5 when you continue the tutorial.

After setting the initial volume, lets now start working on the buttons for adjusting the volume.

To increase the volume, we can simply increment the value of the SoundTransform objects volume property whenever the volume up button is clicked. Go to the volUp listener function and add the following lines highlighted in bold:
function volUp(e:MouseEvent):void 
{
volumeAdjust.volume += .1;
channel1.soundTransform = volumeAdjust;
}

Code explained:
volumeAdjust.volume += .1;
This line increments the current volume property value by .1. So every time the volume up button is clicked, the volume propertys value increases by .1.

channel1.soundTransform = volumeAdjust;
Every time changes are made to the volume property of the SoundTransform object, it must be reapplied to the SoundChannels soundTransform property in order for the changes to take effect. So you have to make sure that you add this line as well.

But wait! Early on, I mentioned that continuously increasing the volume way above a value of 1 will end up distorting the sound. So well need to limit the volume adjustment to a range of just 0 to 1. In order to do that, we can use if statements.

Go back to the volUp function and add the following (highlighted in bold):
function volUp(e:MouseEvent):void 
{
volumeAdjust.volume += .1;
if(volumeAdjust.volume > 1)
{
volumeAdjust.volume = 1;
}
channel1.soundTransform = volumeAdjust;
}
Code explained:
So whenever the volume up button is clicked, the volume property is incremented first. Then before the volume adjustment is applied using the soundTransform property, the if statement checks whether the new volume value has gone over 1. If it has, then the volume property value is immediately brought back down to 1, before the volume adjustment is applied. This effectively limits the maximum volume to 1 no matter how many times the volume button is pressed.

And lastly, for decreasing the volume, we use the same concept. Except for this one, we would like to DECREMENT the value of the volume property instead. And for the if statement, we would like to check whether the volume propertys value is LESS THAN 0. Whenever it goes below 0, then we want to immediately pull it back up again to 0. So that way, we effectively limit the minimum volume to 0. So go to the volDown function and add the following lines highlighted in bold:
function volDown(e:MouseEvent):void 
{
volumeAdjust.volume -= .1;
if(volumeAdjust.volume < 0)
{
volumeAdjust.volume = 0;
}
channel1.soundTransform = volumeAdjust;

}
So there you have it. Youve just created simple volume controls in ActionScript 3.0.

Heres the code in full:
var mySound:Sound = new Sound();
var songURL:URLRequest = new URLRequest("CheerfulSong.mp3");
var channel1:SoundChannel = new SoundChannel();
var volumeAdjust:SoundTransform = new SoundTransform();

volumeAdjust.volume = .5;

mySound.load(songURL);

play_btn.addEventListener(MouseEvent.CLICK, playSound);
stop_btn.addEventListener(MouseEvent.CLICK, stopSound);
volUp_btn.addEventListener(MouseEvent.CLICK, volUp);
volDown_btn.addEventListener(MouseEvent.CLICK, volDown);

function playSound(e:MouseEvent):void
{
channel1 = mySound.play();
channel1.soundTransform = volumeAdjust;
}

function stopSound(e:MouseEvent):void
{
channel1.stop();
}

function volUp(e:MouseEvent):void
{
volumeAdjust.volume += .1;
if(volumeAdjust.volume > 1)
{
volumeAdjust.volume = 1;
}
channel1.soundTransform = volumeAdjust;
}

function volDown(e:MouseEvent):void
{
volumeAdjust.volume -= .1;
if(volumeAdjust.volume < 0)
{
volumeAdjust.volume = 0;
}
channel1.soundTransform = volumeAdjust;
}

Thursday, January 22, 2015

Android beginner tutorial Part 46 DatePickerDialog

Today we will learn how to add and use a DatePickerDialog.

First make sure theres a button in the Activity layout (activity_main.xml):

<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity" >

<Button
android:id="@+id/testButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Call an DatePickerDialog"
/>

</LinearLayout>

Now go to MainActivity.java class and declare a DatePickerDialog instance:

public DatePickerDialog myDialog;

In the onCreate() function, add a click listener to the button. Inside the onClick() handler function, set myDialog to a new DatePickerDialog instance and then call show() method of myDialog.

The DatePickerDialog constructor gets 5 parameters - context, OnDateSetListener object, year, month and day that are set by default.

The OnDateSetListener() object has an onDateSet() method that receives the following parameters: view, year, monthOfYear and dayOfMonth. We can display them using a toast.

Remember that month values range from 0-11. So, january is 0th month and december is 11th.

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

Button button = (Button)findViewById(R.id.testButton);

button.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
myDialog = new DatePickerDialog(MainActivity.this, 0, new OnDateSetListener() {

@Override
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
String date = (monthOfYear+1) + "/" + dayOfMonth + "/" + year;
Toast toast = Toast.makeText(MainActivity.this, date, Toast.LENGTH_SHORT);
toast.show();
}
}, 2012, 11, 31);
myDialog.show();
}
});

}

Full code:

package com.kircode.codeforfood_test;

import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.DatePickerDialog.OnDateSetListener;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.Toast;

public class MainActivity extends Activity{

public DatePickerDialog myDialog;

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

Button button = (Button)findViewById(R.id.testButton);

button.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
myDialog = new DatePickerDialog(MainActivity.this, 0, new OnDateSetListener() {

@Override
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
String date = (monthOfYear+1) + "/" + dayOfMonth + "/" + year;
Toast toast = Toast.makeText(MainActivity.this, date, Toast.LENGTH_SHORT);
toast.show();
}
}, 2012, 11, 31);
myDialog.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;
}

}

The results look like this:



Thanks for reading!

Saturday, January 17, 2015

Android beginner tutorial Part 51 Context Menu

In this tutorial we are going to learn about Context menus in Android.

As I mentioned before, Context menus are menus that appear when the user performs a long-press. A long-press is a screen touch that lasts for 2 or more seconds. Context menus are common in applications on desktops - they appear on right clicks.

First go to activity_main.xml that is located in the res/layout/ folder. Here we add 2 TextView objects (make sure they are big enough), label them Example One and Example Two. Give them ids as shown below:

<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity" >

<TextView android:id="@+id/text_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Example One"
android:textSize="50sp"
/>

<TextView android:id="@+id/text_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Example Two"
android:textSize="50sp"
/>

</LinearLayout>

We are going to make them both react to long-presses. Moreover, well tell them to display different context menus when interacted with.

Go to MainActivity.java nad declare 6 identificator variables:

public static final int IDM_ONE = 101;
public static final int IDM_TWO = 102;
public static final int IDM_THREE = 103;
public static final int IDM_FOUR = 104;
public static final int IDM_FIVE = 105;
public static final int IDM_SIX = 106;

In the onCreate() function, find the two TextViews and call a method called registerForContextMenu() twice, passing each TextView to the function:

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

final TextView tOne = (TextView)findViewById(R.id.text_one);
final TextView tTwo = (TextView)findViewById(R.id.text_two);

registerForContextMenu(tOne);
registerForContextMenu(tTwo);
}

Now create a function called onCreateContextMenu(). Inside of it, after calling the super function, add a switch..case statement that checks what View is passed to the function. The View value is the View that the user has long-pressed on. We can compare its id to R.id.text_one and R.id.text_two and display different context menus like this:

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);

switch(v.getId()){
case R.id.text_one:
menu.setHeaderTitle("Example one context");
menu.add(Menu.NONE, IDM_ONE, Menu.NONE, "Item one");
menu.add(Menu.NONE, IDM_TWO, Menu.NONE, "Item two");
menu.add(Menu.NONE, IDM_THREE, Menu.NONE, "Item three");
break;
case R.id.text_two:
menu.setHeaderTitle("Example two context");
menu.add(Menu.NONE, IDM_FOUR, Menu.NONE, "Item four");
menu.add(Menu.NONE, IDM_FIVE, Menu.NONE, "Item five");
menu.add(Menu.NONE, IDM_SIX, Menu.NONE, "Item six");
break;
default:
break;
}
}

To add item selection listeners to these functions, override a onContextItemSelected() method and use a switch..case statement to check the ids of the selected item to display different messages:

@Override
public boolean onContextItemSelected(MenuItem item){
CharSequence message;
switch(item.getItemId()){
case IDM_ONE:
message = "First item selected";
break;
case IDM_TWO:
message = "Second item selected";
break;
case IDM_THREE:
message = "Third item selected";
break;
case IDM_FOUR:
message = "Fourth item selected";
break;
case IDM_FIVE:
message = "Fifth item selected";
break;
case IDM_SIX:
message = "Sixth item selected";
break;
default:
return super.onContextItemSelected(item);
}
Toast toast = Toast.makeText(this, message, Toast.LENGTH_SHORT);
toast.show();
return true;
}

Now we have 2 TextViews in our application that, when long-pressed on, display different Context menus, that react to item selection events.

Full code:

package com.kircode.codeforfood_test;

import android.app.Activity;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity{

public static final int IDM_ONE = 101;
public static final int IDM_TWO = 102;
public static final int IDM_THREE = 103;
public static final int IDM_FOUR = 104;
public static final int IDM_FIVE = 105;
public static final int IDM_SIX = 106;

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

final TextView tOne = (TextView)findViewById(R.id.text_one);
final TextView tTwo = (TextView)findViewById(R.id.text_two);

registerForContextMenu(tOne);
registerForContextMenu(tTwo);
}

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);

switch(v.getId()){
case R.id.text_one:
menu.setHeaderTitle("Example one context");
menu.add(Menu.NONE, IDM_ONE, Menu.NONE, "Item one");
menu.add(Menu.NONE, IDM_TWO, Menu.NONE, "Item two");
menu.add(Menu.NONE, IDM_THREE, Menu.NONE, "Item three");
break;
case R.id.text_two:
menu.setHeaderTitle("Example two context");
menu.add(Menu.NONE, IDM_FOUR, Menu.NONE, "Item four");
menu.add(Menu.NONE, IDM_FIVE, Menu.NONE, "Item five");
menu.add(Menu.NONE, IDM_SIX, Menu.NONE, "Item six");
break;
default:
break;
}
}

@Override
public boolean onContextItemSelected(MenuItem item){
CharSequence message;
switch(item.getItemId()){
case IDM_ONE:
message = "First item selected";
break;
case IDM_TWO:
message = "Second item selected";
break;
case IDM_THREE:
message = "Third item selected";
break;
case IDM_FOUR:
message = "Fourth item selected";
break;
case IDM_FIVE:
message = "Fifth item selected";
break;
case IDM_SIX:
message = "Sixth item selected";
break;
default:
return super.onContextItemSelected(item);
}
Toast toast = Toast.makeText(this, message, Toast.LENGTH_SHORT);
toast.show();
return true;
}

}

Thanks for reading!

Friday, January 16, 2015

Android PHP JSON tutorial

Here Im going to demonstrate how we can decode JSON encoded data in Android using very simple example. I used Android 2.2 for this.

First here is some extra information about JSON:

1. What is JSON

  • JSON stands for JavaScript Object Notation
  • JSON is lightweight text-data interchange format
  • JSON is language independent 
  • JSON is "self-describing" and easy to understand
                                                           (from w3schools)  
2. Click here to know benefits of JSON over XML

Now lets see simple example of JSON reading in Android.
In my project there is a PHP web service which encodes a string array in to JSON format. Im going to access that web service using Android http client and then it decodes json data. I have tested this on Android 2.2

1. Here is the code for PHP

<?php
$data = array(name => Froyo, version => Android 2.2);
print (json_encode($data));
?>

2. Contents of Android Layout Manifest and Activity files
 main.xml file
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<TextView
android:id="@+id/textView1"
android:layout_width="216dp"
android:layout_height="36dp"
android:layout_weight="1"
android:layout_x="66dp"
android:layout_y="192dp"
android:textAppearance="?android:attr/textAppearanceMedium" />

</AbsoluteLayout>

manifest.xml 
You need to add internet permissions 
 
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.json.php"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".JSONExampleActivity"
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 activity 

package com.json.php;

import android.app.Activity;
import android.os.Bundle;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import android.widget.TextView;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONException;
import org.json.JSONObject;


public class JSONExampleActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://codeincloud.tk/json_android_example.php");
TextView textView = (TextView)findViewById(R.id.textView1);
try {

HttpResponse response = httpclient.execute(httppost);
String jsonResult = inputStreamToString(response.getEntity().getContent()).toString();
JSONObject object = new JSONObject(jsonResult);

String name = object.getString("name");
String verion = object.getString("version");
textView.setText(name + " - " + verion);

}
catch (JSONException e) {
e.printStackTrace();
}
catch (ClientProtocolException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}


}
private StringBuilder inputStreamToString(InputStream is) {
String rLine = "";
StringBuilder answer = new StringBuilder();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));

try {
while ((rLine = rd.readLine()) != null) {
answer.append(rLine);
}
}

catch (IOException e) {
e.printStackTrace();
}
return answer;
}
}

 Result

Click here to download the Android project.

Thats it
 Happy coding! :)

HTML5 Tutorial Sections and Outlines of an HTML5 Document


Title : Sections and Outlines of an HTML5 Document.

Details:Technology : HTML5/JavaScript

Completion Time: 1 Hour

Difficulty : easy

Description :
    
                   I am going to explain some new elements in HTML5 allowing web developers to describe the web document with standard semantics.

Problems solved in HTML5 compared to HTML 4 

1)HTML5 removes the need for <br />
<div>
elements from the outlining algorithm by introducing     a new element,<br />
<section>,the Html Section element.

2)Merging several documents is hard: inclusion of a sub-document in a main document     means changing the level of the HTML Headings Element so that the outline is kept. This  is solved in HTML5 as the newly introduced sectioning elements (<article>, <section>, <nav> and <aside>) are always subsections of their nearest ancestor section, regardless of what sections are created by internal headings.

3)Because each HTML Heading Element is part of the outline, it is not possible to describe a subtitle or secondary title (e.g., <h1>
Justine</h1>
<h2>
Les Malheurs de la Vertu</h2>
creates the outline 1. Justine 1.1 Les Malheurs de la Vertu). HTML5 introduces the <hgroup> element that hides all the heading elements except the first one of the highest rank (e.g., <hgroup><h1>
Justine</h1>
<h2>
Les Malheurs de la Vertu</h2>
</hgroup> creates the outline 1. Justine).

4)In HTML4, every section is part of the document outline. But documents are often not that linear. A document can have special sections containing information that is not part of, though it is related to, the main flow, like an advertisement block or an explanation box. HTML5 introduces the <aside> element allowing such sections to not be part of the main outline.

5)Again, in HTML4, because every section is part of the document outline, there is no way to have section containing information related not to the document but to the whole site, like logos, menus, table of contents, or copyright information and legal notices. For that purpose, HTML5 introduces three specific sections elements: <nav> for collections of links, such as a table of contents, <footer> and <header> for site-related information.

Here is an Example for Showing Basic Html5 Elements(<section>,<article>,<header>,<nav>,<footer>,<aside>):

<section>  : Our Home page has been divided into number of sections which consisits of header,article 1,article 2 and footer.we have innersections also where we can embed animations inside section , we can write articles inside section element for more details , please go through the code , demo and image below.






From , the above image we can see <header>,<nav,<article>,<aside>,<footer> and some animations where a girl rides a bicycle,birds flies in the sky.

All this elements are aligned with particular space looking the code our body of the page starts with <section> tag with id="wrapper" for style and this section consists <header>,<nav>,<article>,<aside>,<footer> elements.
<header> : Next going through code we have <header> element where place some logo there.
<article>  : We have article tag for writing some articles like some tutorials,stories etc.
<aside>    : We have this element for writing some notes side to our articles or displaying some
                    advertisements.
<footer>  : We have this tag for writing some copy write notices or linking up some back links for              our sitemap index.
animation : I have included some sections which wraps css3 elements or style elements using ids assigned in the css style sheet.

Index.html















HTML5 Semantics Example








HTML5 Semantics Example














What We Provide?


Posted on by Alex Jones



We Provide All Domestic academic admissions for B.Tech,M.tech,Mca,Mba,Bds,Mbbs through out the country.we provide admissions for councilling fee only with out any donations,we look after accomdation along with career guidence.we are developing mobile app for colleges and students to communicate with each others and get admissions online from your mobile only.we provide online tutorials for students who want to learn new technologies with out any fee







Technologies


Posted on by Alex Jones



We Provide online courses for the following :


JAVA


HTML5


JavaScript


Mobile Development




















SS Educational Consultancy



Here is the code for css
@charset "utf-8";
/* CSS Document

Name: Vivek Kumar
Email: vivekwebmaker@gmail.com
Company:IDS Infotech Ltd.
*/

* {
margin:0px;
padding:0px;
}
body {
overflow-x:hidden;
}

/*
//////////////////////////////////////////////////
CLOUD
//////////////////////////////////////////////////
*/
#clouds {
padding:100px 0px 0px;
background:#c9dbe9;
background:-webkit-linear-gradient(top, #c9dbe9 0%, #fff 100%);
background:-linear-gradient(top, #c9dbe9 0%, #fff 100%);
background:-moz-linear-gradient(top, #c9dbe9 0%, #fff 100%);
}
.cloud {
width:200px;
height:60px;
background:#fff;
border-radius:200px;
-moz-border-radius:200px;
-webkit-border-radius:200px;
position:relative;
}
.cloud:before, .cloud:after {
content:;
position:absolute;
width:100px;
height:80px;
background:#fff;
position:absolute;
top:-15px;
left:10px;
border-radius:100px;
-moz-border-radius:100px;
-webkit-border-radius:100px;
-webkit-transform:rotate(30deg);
transform:rotate(30deg);
-moz-transform:rotate(30deg);
}
.cloud:after {
width:120px;
height:120px;
top:-55px;
left:auto;
right:15px;
}

/*
//////////////////////////////////////////////////
CLOUD Animation Code
//////////////////////////////////////////////////
*/

.x1 {
-webkit-animation:moveclouds 18s ease-in-out infinite;
-moz-animation:moveclouds 18s ease-in-out infinite;
-o-animation:moveclouds 18s ease-in-out infinite;
top:-10px;

}
.x2 {
left:200px;
top:-50px;
-webkit-transform:scale(0.6);
-mox-transform:scale(0.6);
transform:scale(0.6);
opacity: 0.6; /*opacity proportional to the size*/
-webkit-animation:moveclouds 25s ease-in-out infinite;
-moz-animation:moveclouds 25s ease-in-out infinite;
-o-animation:moveclouds 25s ease-in-out infinite;
}
.x3 {
left:0px;
top:-175px;
-webkit-transform:scale(0.8);
-mox-transform:scale(0.8);
transform:scale(0.8);
opacity: 0.6; /*opacity proportional to the size*/
-webkit-animation:moveclouds 30s ease-in-out infinite;
-moz-animation:moveclouds 30s ease-in-out infinite;
-o-animation:moveclouds 30s ease-in-out infinite;

}
.x4 {
left:470px;
top:-195px;
-webkit-transform:scale(0.75);
-mox-transform:scale(0.75);
transform:scale(0.75);
opacity: 0.75; /*opacity proportional to the size*/
-webkit-animation:moveclouds 15s ease-in-out infinite;
-moz-animation:moveclouds 15s ease-in-out infinite;
-o-animation:moveclouds 15s ease-in-out infinite;

}
.x5 {
left:-100px;
top:-150px;
-webkit-transform:scale(0.8);
-mox-transform:scale(0.8);
transform:scale(0.8);
opacity: 0.8; /*opacity proportional to the size*/
-webkit-animation:moveclouds 35s ease-in-out infinite;
-moz-animation:moveclouds 35s ease-in-out infinite;
-o-animation:moveclouds 35s ease-in-out infinite;

}
.x6 {
left:50px;
top:-280px;
opacity: 0.4; /*opacity proportional to the size*/
-webkit-animation:moveclouds 22s ease-in-out infinite;
-moz-animation:moveclouds 22s ease-in-out infinite;
-o-animation:moveclouds 22s ease-in-out infinite;

}
.x7 {
left:-80px;
top:-255px;
-webkit-transform:scale(0.8);
-mox-transform:scale(0.8);
transform:scale(0.8);
opacity: 0.8; /*opacity proportional to the size*/
-webkit-animation:moveclouds 40s ease-in-out infinite;
-moz-animation:moveclouds 40s ease-in-out infinite;
-o-animation:moveclouds 40s ease-in-out infinite;

}
@-webkit-keyframes moveclouds {
0% {
margin-left:110%;
}
100% {
margin-left:-110%;
}
}
@-moz-keyframes moveclouds {
0% {
margin-left:110%;
}
100% {
margin-left:-110%;
}
}
@-o-keyframes moveclouds {
0% {
margin-left:110%;
}
100% {
margin-left:-110%;
}
}

/*
//////////////////////////////////////////////////
GRASS
//////////////////////////////////////////////////
*/
.grass {
background:url(grass.png) bottom center no-repeat;
height:295px;
width:100%;
bottom:0px;
position:absolute;
}
.cycle {
/*background:url(cycle-2.png) no-repeat;*/
width:279px;
height:260px;
position:absolute;
right:0px;
bottom:-2px;

}
.bycycle {
background:url(cycle-2.png) no-repeat;
width:279px;
height:260px;
position:absolute;
z-index:1;
}
/*
//////////////////////////////////////////////////
Cycle Animation Code
//////////////////////////////////////////////////
*/
.cycle-ride {
-webkit-animation:movecycle 25s ease-in-out infinite;
-moz-animation:movecycle 25s ease-in-out infinite;
-o-animation:movecycle 25s ease-in-out infinite;
}
@-webkit-keyframes movecycle {
0% {
margin-right:100%;
}
100% {
margin-right:-100%;
}
}
@-moz-keyframes movecycle {
0% {
margin-right:100%;
}
100% {
margin-right:-100%;
}
}
@-o-keyframes movecycle {
0% {
margin-right:100%;
}
100% {
margin-right:-100%;
}
}

/*
//////////////////////////////////////////////////
BIRD
//////////////////////////////////////////////////
*/
.bird {
background:url(birds.png) no-repeat;
width:376px;
height:191px;
position:absolute;
}
/*
//////////////////////////////////////////////////
BIRD Animation Code
//////////////////////////////////////////////////
*/
.fly {
-webkit-animation:birdfly 20s ease-in-out infinite;
-moz-animation:birdfly 20s ease-in-out infinite;
-o-animation:birdfly 20s ease-in-out infinite;
}
@-webkit-keyframes birdfly {
0% {
margin-left:100%;
top:300px
}
20% {
top:200px;
}
40% {
top:150px;
}
50% {
top:100px;
}
60% {
top:50px;
}
70% {
top:-300px;
}
80% {
top:-50px;
}
100% {
margin-left:-100%;
top:-70px;
opacity:.4;
-webkit-transform:scale(0.4);
-moz-transform:scale(0.4);
transform:scale(0.4);
}
}
@-moz-keyframes birdfly {
0% {
margin-left:100%;
top:300px
}
20% {
top:200px;
}
40% {
top:150px;
}
50% {
top:100px;
}
60% {
top:50px;
}
70% {
top:-300px;
}
80% {
top:-50px;
}
100% {
margin-left:-100%;
top:-70px;
opacity:.4;
-webkit-transform:scale(0.4);
-moz-transform:scale(0.4);
transform:scale(0.4);
}
}
@-o-keyframes birdfly {
0% {
margin-left:100%;
top:200px
}
20% {
top:150px;
}
40% {
top:100px;
}
50% {
top:500px;
}
60% {
top:0px;
}
70% {
top:-50px;
}
80% {
top:-70px;
}
100% {
margin-left:-100%;
top:-100px;
opacity:.4;
-webkit-transform:scale(0.4);
-mox-transform:scale(0.4);
transform:scale(0.4);
}
}

.name{
font-size:30px;
color: transparent;
right:20px;
position:absolute;
bottom:0px;

-webkit-animation:name 25s ease-in-out infinite;
-moz-animation:name 25s ease-in-out infinite;
-o-animation:name 25s ease-in-out infinite;
}

@-webkit-keyframes name {
0% {
text-shadow: 0 0 0px rgba(0,0,0,1);
}
100% {
text-shadow: 0 0 10px rgba(0,0,0,0.5);
}
}
@-moz-keyframes name {
0% {
text-shadow: 0 0 0px rgba(0,0,0,1);
}
100% {
text-shadow: 0 0 10px rgba(0,0,0,0.5);
}
}
@-o-keyframes name {
0% {
text-shadow: 0 0 0px rgba(0,0,0,1);
}
100% {
text-shadow: 0 0 10px rgba(0,0,0,0.5);
}
}





/* Create the animation blocks */


/* Spinning, gradient circle; CSS only! */
.cycle-front, .cycle-back {
width: 108px;
height: 107px;
position:absolute;
bottom:8px;
right:8px;

background:url(wheel-front.png) no-repeat;

-webkit-animation:spin 3s ease-in-out infinite;
-moz-animation:spin 3s ease-in-out infinite;
-o-animation:spin 3s ease-in-out infinite;

}

.cycle-back{
background:url(wheel-back.png) no-repeat;
bottom:8px;
left:8px;
}

@-webkit-keyframes spin {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
@-moz-keyframes spin {
from {
-moz-transform: rotate(0deg);
}
to {
-moz-transform: rotate(360deg);
}
}
@-o-keyframes spin {
from {
-o-transform: rotate(0deg);
}
to {
-o-transform: rotate(360deg);
}
}