Showing posts with label android. Show all posts
Showing posts with label android. Show all posts

Saturday, February 14, 2015

Setting up Android Development Environment

Due to the increase in the android users the demand for quality applications is also increasing. As a result more and more programmers are jumping into the field of android development. Developing any android application requires certain development tools. In this android tutorial I am telling you the step by step procedure for setting up android development environment.

Also Read: How to Make a Calculator App for Android

Setting up Android Development Environment

Steps for Setting up Android Development Environment

The first step of getting started in android application development is to setup an android development environment. There are two choices:
  • The first one is using Eclipse IDE
  • The Second one is using Android Studio 

Since Android Studio is still the beta version (that means it is not completely tested) so we will focus on setting up Eclipse IDE

1. The first thing we need to do is installing Java JDK. Download the latest version of java from below link.
http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. The next thing we need to do is install Eclipse IDE (the software we are going to use to develop android applications). Visit the link below and download eclipse for java developers.
https://eclipse.org/downloads/packages/eclipse-ide-java-developers/lunasr1

3. Now we need to is install the android sdk. This sdk is required to run your custom android projects on emulator in order to debug it. You can also use android devices to debug your projects. Download Android SDK from the following link.
http://developer.android.com/sdk/older_releases.html

4. After downloading extract the sdk folder and open sdk manager, select available packages, check the android Repository and hit install selected.

5. Accept all the licenses and download it (if you are an advance user you can select only the required packages).

6. Now we need to set preferences so open eclipse IDE go to Windows > Preferences > Android > SDK Location > Browse the files that we have extracted (SDK MANAGER).

If you are getting any difficulty in above steps then you can check below video tutorial.


Video Tutorial for Setting up Android Development Environment


Image Source
Read more »

Thursday, February 5, 2015

NETTAB SKAT 3G QUAD v4 2 2 Android Tablet firmware


NETTAB SKAT 3G QUAD NT-3805C v4.2.2 Android tablet firmware 

Specifications:


LCD                

Screen Resolution 

Processor 
Chipset / Boxchip
RAM

Built in Memory
External Memory
Support Micro Card  (MAX 32GB)                                                             
Wifi

Blue tooth
3G
                      
Camera
                     
HDMI
Supported
Speaker
Built IN
Weight
0.623 KG
Android Version
4.0 ICS
Flashing Tool
RKbatch Tool
Flashing Tutorials
Flashing Tutorial for Rockchip 







Download Official Updates
Read more »

IJOY SYGNUS ANDROID TABLET FIRMWARE

I-JOY SYGNUS TABLET FIRMWARE

Specifications:


LCD                
 7" Capacitive Touch Screen  5 Points
Screen Resolution 
800x400 Pix
Processor 
1.2 Ghz ARM CortEx A8 
Chipset / Boxchip
Allwinner A13
RAM
512 MB DDR3
Built in Memory
4 GB
External Memory
Support Micro Card  (MAX. 32GB)
Wifi
802.11 b/g/n  supported
Blue tooth
 N/A
3G
                Support USB 3G Dongle, EVDO/WCDMA                                     
Camera
            0.3 MP Front          
HDMI
1.4
Speaker
N/A
Weight
330g
Android Version
4.1
Flashing Tool
Download :  LiveSuit Pack
Flashing Tutorials
see Tutorial : how to flashing tablet with Livesuit


You can also use Multi tools to wipe rom  : Android Multi Tools

Note:
The following firmware / ROM file will be used   when your tablet facing various problems . In case of
1. Forgotten Pattern Lock , 
2.Too many pattern attampt / Reset user lock
3.Tablet stuck on Gmail account
4. Tablet stuck on Android logo
5.Tablet hang on start up 
you can use this Tablet firmware  ROM to make your Android China tablet working again . 
Flashing stock firmware should be last option.
Additional Downloads :
SYGNUS technical data
SYGNUS manual
DOWNLOAD OFFICIAL FIRMWARE
Read more »

Android beginner tutorial Part 63 BroadcastReceiver

Today well learn about Broadcast Receivers.

A Broadcast Receiver is a component used for catching external events and reacting to them. Events can be dispatched by other applications, servies, as well as the system. In the previous tutorials, weve already covered handling events using Intents. The components that we used as examples can also react to anonymous messages between applications using sendBroadcast() method.

Using Broadcast Receivers, it is possible to listen to Intents of other applications, change your applications behaviour based on the data, react to changes in the system and events of other applications.

Just like all activities extend Activity class and all services extend Service class, all broadcast receivers extend BroadcastReceiver class.

The class has a single callback method - onReceive().

When a message arrives to the receiver, Android calls onReceive() method and passes the Intent message to it. The Broadcast Receiver component is only active during the execution of this method. The process thats currently executing the code in onReceive() is considered top priority and will be saved, unless theres a critical lack in memory in the system.

When the program returns from onReceive(), the Broadcast Receiver object becomes inactive and the system basically thinks "this BroadcastReceivers job is done" and will get rid of it if the memory taken by this object is needed for higher priority processes.

This sounds fair and all but it can actually cause a problem. For example, imagine if your onReceive() function creates a separate thread with a long process in it. While the process is still running, the onReceive() function will already be considered inactive by the system. If onReceive() is actually expecting a response from the thread, that response may never come since the BroadcastReceiver could get deleted by then.

But if theres a problem theres always a solution. Of course, everything depends on the situation, sometimes one solution might be more optimal than the other one.

One way to solve this would be to create a Service in the onReceive() function and let the Service do the work to keep the content of the process active during the whole operation process.

Thats all for today. Next time we will do something practical.

Thanks for reading!
Read more »

Empire Z Android Game free download

Empire Z 

Android Game 

Manage Your City and Save People from Zombies. 

Survive after Zombie Apocalypse 

download android games for free 

Empire Z is strategy game . The game is about the build a strong city hold, make alliance with other online players , train your troops,make farms,roads,resident  and kill the zombies to save your peoples. 


Game Feature:


Earn prize for your city and your alliance.
Fantastic Graphics

Game Requirements :


OS 2.3 and Above
Version 0.0.6
Download APK from Google PlayStore
Read more »

Android Web service Access Tutorial

Updated tutorial for new versions >> http://codeoncloud.blogspot.com/2013/06/android-java-soap-web-service-access.html

This simple example demonstrates how we can access a java web service  from Android application.
We cant connect Android 3.0 and after versions to the internet in the main thread. So we have to start new thread. In this tutorial Im going to demonstrate how we can access a simple java web service  by starting new thread. I have tested this on Android 4.0.3 platform.

Following is the sample java code for web service class. Deploy this web service on Tomcat server at local host. To implement this web service follow these posts.
1. Create java web service in Eclipse using Axis2 (Part 01)
2. Create java web service in Eclipse using Axis2 (Part 02) 

package com.android.ws;
public class PrintMsg {
public String sayHello(){
return "Hello Chathura";
}
}
Here is the code for Android application to invoke deployed web service.
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import android.widget.TextView;
import android.app.Activity;
import android.os.Bundle;

public class AndroidWSClientActivity extends Activity {

private static final String SOAP_ACTION = "http://ws.android.com/sayHello";
private static final String METHOD_NAME = "sayHello";
private static final String NAMESPACE = "http://ws.android.com/";
private static final String URL = "http://175.157.229.119:8080/AndroidWSTest/services/PrintMsg?wsdl";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Thread networkThread = new Thread() {
@Override
public void run() {
try {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);

HttpTransportSE ht = new HttpTransportSE(URL);
ht.call(SOAP_ACTION, envelope);
final SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
final String str = response.toString();

runOnUiThread (new Runnable(){
public void run() {
TextView result;
result = (TextView)findViewById(R.id.textView1);//Text view id is textView1
result.setText(str);
}
});
}
catch (Exception e) {
e.printStackTrace();
}
}
};
networkThread.start();
}
}
}

Note:
SOAP_ACTION in line 13 is "NAMESPACE/METHOD_NAME".

METHOD_NAME
in line 14 is WSDL operation. You can find something like <wsdl:operation name="sayHello"> in your WSDL sayHello is METHOD_NAME here.

NAMESPACE in line 15 is targetNamespace in the WSDL. Replace that & add a "/" to the end .

URL in line 16 The URL of WSDL file. In my case it is http://175.157.229.119:8080
/AndroidWSTest/services/PrintMsg?wsdl
blue colored is the ip of the server replace it with your ip & red colored is the port number.

Make appropriate changes according to your WSDL. I think it is easy to find those things if you open WSDL from a web browser. For more details look the image :



  
Add Internet permission to Androidanifest.xml file.(Look highlighted line)












}



Run the application using Emulator.
Result :


You can download updated project here here
Password :cloud

 
If you find this post helpful dont forget to leave a comment. Your comments always encourage me!
Read more »

Wednesday, February 4, 2015

Android beginner tutorial Part 6 FrameLayout containers

Today well learn more about the FrameLayout layout type.

Open up our existing Android project in Eclispse and open the activity_main.xml file in res/layout/ directory in xml mode.

Right now we have a RelativeLayout container with a TextView inside. Rename the RelativeLayout to FrameLayout, and change the attributes to the values as in the example below. Instead of the TextView, add a Button, with the attribute values as shown below:

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

<Button
android:text="Test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

</FrameLayout>

If you take a look at the application layout using the Graphical Layout mode now, youll see this:



Now Ill explain the code. The first two attributes in the root tags, prefixed with xmlns, are namespaces. They are included in the code by default and we should leave those as they are. The next two are layout_width and layout_height. The match_parent in layout_width basically tells the component to stretch in width to match the width of its parent, which is in this case the available device screen. The tools:context attribute is also added automatically, it specifies which Activity this layout is representing (based on this value, the UI editor will know which theme to use to display your content).

The height of the FrameLayout is set to wrap_content, which makes the component only take as much space as is needed.

In this case, the required height is defined by the height of the single child of the container, which is the button. The height and width of the button are both set to wrap_content. This means the button will stretch just enough to fit the text inside it, which in this case is "Test".

Note that in this example I am strictly applying the string value to the android:text attribute of the Button. It works in this example, but normally it is recommended to store all string values in a separate xml file and refer to those values using ids. This is done to be able to support different languages, and do other manipulations with string values.

So, the frame layout container contains a single button, which is spawned in the top left corner. Any new children will also be spawned there, and put on top of the previous children. Lets add one more button, set its width and height to match_parent, and also set the FrameLayouts height to match_parent:

<FrameLayout 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"
tools:context=".MainActivity" >

<Button
android:text="Test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Test 2" />

</FrameLayout>

Results:



The second button takes up all of the screen space. It is also spawned on top of the first button, making it impossible to use the first button.

FrameLayouts are not used very often, because the content is not flexible this way, and such layouts are mostly used to create overlays.

Thats all for today.

Well take a closer look at the LinearLayout container next time.

Thanks for reading!
Read more »

AOC Breeze MW0831 8 inch Android Tablet Firmware



AOC MW0831 Breeze 8 inch Android Tablet, Firmware ,Support , Specifications & Review. 

Review: 

The Aoc MW0831 Tablet is ultra fast duo core tablet. Carrying Android 4x ICS  with faster duo core processor 8 inch of display size. The Tablet quality is good , updates are available , Tabet Support forums and service center is updated as well. In my opinion AOC Tablets are best to buy. 
Company Review : Features
Where to BuyAOC Breeze MW0831

Specifications:

LCD                
8"  Capacitive Touch Screen
Screen Resolution 
1024 x 768 Pix
Processor 
1.4GHZ Duo-Core 
Chipset / Boxchip
 Rockchip
RAM
1GB DDR3 DRAM
Built in Memory
8 GB
External Memory
Support Micro Card  (Max 32GB)
Wifi
802.11 b/g/n  supported
Blue tooth
2.1
Sim
 N/A
Camera
       2 Megapixel front                                    
HDMI 
Available , Usb 2.0, HDMI (Mini C) 
Speaker
Built IN 0.7W
Weight
1.21lbs
Android Version
4X ICS



Tablet PC Common Problems/Restore Scenarios . 

The following firmware , ROM file will be used  when your Android tablet facing various problems . 
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. Google play store having problems or generating errors. 
7.Upgrading to new Android OS.
you can use this Android Tablet firmware,  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 Tools:
Download: RKbatch Tool

Tutorials :

How to Flash, Update AOC Tablets Firmware

You may also like to read : Flashing Tutorial for Rockchip 

Downloads 
Firmware Updates


Other AOC Tablets Updates 
AOC MW0922
AOC MW0931
AOC MW0811
AOC MW0812
AOC MW0731
Read more »

Android beginner tutorial Part 84 Styles and Themes

Today we will learn about styles and themes in Android.

A Style is a collection of properties that set the appearance of a single View or window. The idea behind styles is similar to CSS - you define styles of an object somewhere outside of the layout code and then just apply the style to one or multiple elements.

A Theme is a style that is applied to an entire Activity or all Activities of an application.

The process for creating styles and themes is the same.

Create a new XML style in res/values/ directory, you can use whatever name you want.

Add this code inside:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SpecialText" parent="@android:style/TextAppearance.Medium">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#FF0000</item>
</style>
</resources>

As you can see, its a simple XML containing a style node which has 3 items. Each item represents an attribute and its value. The style node also has a "name" attribute and a "parent" one.

The name is the unique identificator for this style, this is the name that you will later use to refer to this style.

The parent is an optional vattribute that specifies the resource ID of another style from which this style should inherit properties. This way you can override the inherited style properties if needed. The resource can be of any type as long as it contains the needed style. It is recommended that you always inherit the default styles for the specific views - directly or indirectly.

After the style is created, you can use it by simply setting the style property of a View.

<TextView
style="@style/SpecialText"
android:text="Special text!" />

Note that the style attribute does not need an android: prefix.

If you apply a style to a ViewGroup container, the style will NOT be inherited by its children. To make it inheritable, set the style as a theme.

To set a theme to the whole application (all of its Activities), go to the AndroidManifest XML file and set the android:theme property of the application node:

<application android:theme="@style/MyTheme">

If you want to set it to a single Activity, just do the same with the activity tag.

There are also a few pre-built themes that you can use. Theme.Dialog, for instance, displays an Activity like a dialog window:

<activity android:theme="@android:style/Theme.Dialog">

If you want to create a new theme based on an existing one, you can add the base theme as the parent of the style.

Thats all for today.

Thanks for reading!
Read more »

Hyundai X700 7 inch Rockchip Android Tablet PC Firmware flashing tools tutorials

Hyundai X700 7 inch 
Rockchip Android Tablet PC Firmware ,flashing tools and tutorials
Non Bluetooth version 
Hyundai X700 

Wiki

Read article about Rockchip CPU on Wikipedia 



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.
This is not rooted firmware.
Note : Flashing generic tablet firmware should be last option.This stock rom is only for Non Bluetooth Version. 

Tablet Specifications:

Brand: Hyundai 
Model : X700

LCD                
7"    IPS Capacitive Multi Touch Screen
Screen Resolution 
1024 x 600 Pix
Processor 
1.6 Ghz  Dual Core ,Mali 400MP 
Chipset / Boxchip
 Rockchip RK3066
RAM
1GB 
Built in Memory
8 GB
External Memory
Support Micro Card  (Max 32GB)
Wifi
802.11 b/g/n  supported
Blue tooth
N/A
Sim
 N/A
Camera
      0.3  Megapixel front                                    
HDMI 
Available , Usb 2.0, HDMI (Mini C) 
Speaker
N/A
Weight
287 g
Android Version
4.1
3200 mAh Battery


Flashing Tutorials :


Read Before : Flashing Tutorial for Rockchip 
Download Flashing Instructions : PDF

Drivers for Rockchip:

Download Drivers for Rockchip tablets

Flashing Tools:

Download: RKbatch Tool

Recommended  Tools:

you can also use:Android Tools for Rockchip Tablets

Downloads: 
Stock Firmware by roman2025
Read more »

Android beginner tutorial Part 9 RelativeLayout container

Today well learn about the fourth layout type - RelativeLayout.

This layout type is the most flexible, because it allows the developer to position the children of this container relatively to the container itself or relatively to its neighbour children.

In RelativeLayout, children are positioned in such a way, that if you align the first child to the center of the screen, the other children (which are aligned to this child) are also aligned to the center. Therefore, to properly display elements on the screen, you need to first declare the object, relative to which other objects will be positioned.

It is not necessary to add ids to all elements in your application, but defining them for children of a RelativeLayout is important, because this way we can refer to these elements to position other children relative to the said element.

An id value of an object is set this way:

android:id="@+id/myElement"

The + symbol is used only when declaring the id for the first time. When you later refer to this object, simply use @id/myElement.

To create a RelativeLayout simply rename the TableLayout from the previous tutorial to RelativeLayout. All the attributes remain the same:

<RelativeLayout 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"
tools:context=".MainActivity" >

Now lets add a button and lets center it. Well specify its id, set it to btn_center. To align it to the center of the parent, set its layout_centerInParent value to true.

You can type "android:" and then pause for a second if youre using Eclipse IDE, then after a moment youll see a drop down tip menu which displays all the possible attribute names and their description. This is a very useful feature, because it basically shows you the documentation quickly and when you need it. You can then add "l" or "layout" to narrow the menu down to the layout attributes.

Anyway, this is the button weve created:

<Button 
android:text="Center"
android:id="@+id/btn_center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>

Now lets add another button, which will be positioned relative to our first button. Set its toRightOf and alignTop values to @id/btn_center:

<Button 
android:text="Rel right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/btn_center"
android:layout_alignTop="@id/btn_center"/>

Full code:

<RelativeLayout 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"
tools:context=".MainActivity" >

<Button
android:text="Center"
android:id="@+id/btn_center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>

<Button
android:text="Rel right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/btn_center"
android:layout_alignTop="@id/btn_center"/>


</RelativeLayout>

The results:



You can see that the Center button is centered, and the second button is aligned to its right edge.

You can play around with all the possible attributes. Here is another example:

<RelativeLayout 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"
tools:context=".MainActivity" >

<Button
android:id="@+id/btn_center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Center" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/btn_center"
android:layout_toRightOf="@id/btn_center"
android:text="Rel right" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/btn_center"
android:layout_toLeftOf="@id/btn_center"
android:text="Rel left" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/btn_center"
android:layout_centerHorizontal="true"
android:text="Rel bottom" />

<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/btn_center"
android:layout_centerHorizontal="true"
android:text="Rel top" />

</RelativeLayout>

The results:




The RelativeLayout container is not used very often, because the layout looks different on each screen size and if you use it, you should always test your application on many different screen sizes, since problems such as element overlapping might arise.

Thats all for today.

Thanks for reading!
Read more »

Tuesday, February 3, 2015

Lifeware FT2008 Rockchip Android Tablet PC Firmware

Lifeware FT2008 8 inch 
Rockchip Android Tablet PC Firmware 

Read article about Rockchip CPU on Wikipedia
Tablet Specifications:

LCD                
8"  IPS  Capacitive Touch Screen
Screen Resolution 
1024 x 768 Pix
Processor 
1.6 Ghz  
Chipset / Boxchip
 Rockchip
RAM
1GB 
Built in Memory
8 GB
External Memory
Support Micro Card  (Max 32GB)
Wifi
802.11 b/g/n  supported
Blue tooth
N/A
Sim
 N/A
Camera
       2 Megapixel front , 5Mp rare cam                                    
HDMI 
Available , Usb 2.0, HDMI (Mini C) 
Speaker
Built IN 0.7W
Weight
1.21lbs
Android Version
4X ICS



Tablet PC common problems /Restore options . 

The following firmware , ROM file will be used  when your Android tablet PC facing various problems . 
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. Market Android  having problems or generating errors. 
7.Upgrading to new Android OS.
you can use this Android Tablet firmware,  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 Tools:
Download: RKbatch Tool

Tutorials :

You may also like to read : Flashing Tutorial for Rockchip 
Download Flashing Instructions : PDF
Downloads: 
Firmware Updates
Read more »

Android beginner tutorial Part 26 AnalogClock and DigitalClock widgets

In this tutorial we will learn about the AnalogClock and DigitalClock widgets.

There are 3 classes related to time in Android SDK - AnalogClock, DigitalClock and Chronometer. They are all subclasses of TextView.

Today well cover the first two widgets. They are very simple to implement and require no java code to implement - just add them in the layout XML and they will work.

Both of these widgets just display time. No other interaction can be performed by default.

Go to activity_main.xml and create a simple layout. Lets add both of the clocks to our application.

The AnalogClock instance:

<AnalogClock android:id="@+id/analogClock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>

And the DigitalClock one:

<DigitalClock android:id="@+id/digitalClock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="48sp"
/>

Full code:

<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"
android:gravity="center"
tools:context=".MainActivity" >

<AnalogClock android:id="@+id/analogClock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>

<DigitalClock android:id="@+id/digitalClock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="48sp"
/>

</LinearLayout>

As you can see, its very easy.

As I already said, both of these classes subclass TextView. This means that all the properties and methods of TextView can be used with these classes. In this example, I set the text size using the android:textSize attribute of the DigitalClock object.

If you run the application, it looks like this:



Thanks for reading!
Read more »

ONYO VIP Edition 7 Official Android Tablet Firmware

ONYO VIP Edition 7 Firmware.

Android Tablet

DOWNLOAD OFFICIAL FIRMWARE

Read more »

Basic Android application with Google maps v2 API

In this post I will illustrate how to make settings for Google maps v2 API in Android Manifest.

1. Create an Android project.
  • Use API level 11 or above for minimum required SDK.
  • Give the same package name which you gave when you are obtaining the API key from Google.
  • Keep other settings as default 
 2. We need to make some changes Android Manifest.xml
  • Open the Manifest.xml and add following permissions as a child of the <manifest> element
    





     
  • Google Maps Android API uses OpenGL ES version 2 to render the map there for we need to define the feature in Manifest file. Add following lines as a child of the <manifest> element.

  • Add the API key by adding following lines as a child of the <application> element, inserting it just before the closing tag </application> 
 
  • Change the android:value="AIzaSyARrx5gAxtNJCHUBvwyIz4uZEFAm3R60kI" with the API key given by Google
  • Finally your Manifest.xml should be like this.


























3. To use Google maps in our Android project we have to add Google play services lib project.
  • First check whether Google Play services are installed.
  • To do that open Android SDK manager expand the Extras.
  • Check the status of  Google Play Services is installed if it is not installed you have to install it first.
 
  • Then to import the Google play services lib project in to the work space, in Eclipse select
    File >> Import >> Android >> Existing Android Code Into Workspace
  • Click Next and select the Root Directory, browse to the google-play-services_lib. In my case it is in C:Androidadt-bundle-windows-x86-20130219sdkextrasgooglegoogle_play_serviceslibprojectgoogle-play-services_lib
  • Most of the time you can find it under the sdkextrasgooglegoogle_play_serviceslibproject directory.  
  • Select the Copy project into workspace and click Finish.

4. The next step is to add the lib project into the our newly created projects references.
  • Right click on the project select Properties >> Android and then click on Add button under Library
  •  In the project selection window select google-play-services_lib project and then click  OK
  •  Then under the libraries there should be the google-play-services_lib project with a green tick.

 5. As the final step we have to add the fragment for the map in to xml layout.
  • Open the res >> layout and activity xml lay out file and copy following code to create the fragment.

  • For this simplest example dont need to do any change for the Activities java file, keep it as it is.
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

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

Now you can run the project. If you are running this on Android emulator you have to do certain installations on AVD I will describe that in my next post.


Read more »