Sony to announce Android based TV - State of the Android nation

The news is hot. According to Bloomberg Sony will announce an Android based television in May.

I assume that this action will open up another front for Android Application Development.

The Android platform looks pretty bright from development point of view. Within a short time the one phone (G1) OS has grown into a significant player in the operating system market.
Statistics clearly show that Android is heavily gaining market share in the smartphone market. That is already a stable trend beyond discussion.

How to use canvas in your android apps - Part 2

SDK Version: 
M3

In the second part of this tutorial series, I will show you what you can do with canvas and paint.


If you complete the first part, your onDraw method in Panel class is similar as this:

  1.         @Override
  2.         public void onDraw(Canvas canvas) {
  3.                
  4.                 Paint paint = new Paint();
  5.                
  6.  
  7.                 Bitmap kangoo = BitmapFactory.decodeResource(getResources(),
  8.                                 R.drawable.kangoo);
  9.                 canvas.drawColor(Color.BLACK);
  10.                 canvas.drawBitmap(kangoo, 130, 10, null);
  11.                
  12.         }
  13.          

We will use the the Paint type object this time. You can use it to draw lines, circles and text on your canvas. For example this two lines will draw a red circle for you.

  1. paint.setColor(Color.RED);

How to use canvas in your android apps - Part 1

SDK Version: 
M3
If you want to use a custom layout with a canvas in your application, this tutorial may be useful to you. We will draw a kangoo at the end of this tutorial.


There is a cool article on site Custom View - HorizontalSlider, what you can use to understand the following code:

  1. [...]
  2. <com.helloandroid.canvastutorial.Panel android:id="@+id/SurfaceView01" android:layout_width="wrap_content"
  3.  
  4. android:layout_height="wrap_content" android:maxHeight="40dip">
  5. </com.helloandroid.canvastutorial.Panel>
  6. [...]

This is your main.xml.

Your main class extends Activity and similar as the following code snip:

  1. public class Canvastutorial extends Activity {
  2.     /** Called when the activity is first created. */
  3.     @Override

Mastering Android Widget Development - Part5 - Final

SDK Version: 
M3

In this last part of the tutorial we will implement buttons to the appWidget, which will directly interact with the appWidget functionality.
We will have 2 buttons, a plus button to add one more day to the target date, and a minus button to decrease time left by one day.

First add the buttons to the countdownwidget.xml layout:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout
  3.   xmlns:android="http://schemas.android.com/apk/res/android"
  4.   android:layout_width="wrap_content"
  5.   android:layout_height="wrap_content" android:orientation="vertical">
  6.  
  7. <TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Time left"></TextView>
  8. <LinearLayout android:id="@+id/LinearLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal">

Hello Baby widget feature update - notification tutorial

SDK Version: 
M3

We have updated our Hello Baby widget, with a notification feature. So I'm using this opportunity, to show you how to use notifications with widgets.

Hello readers, my name is Tamas, and I'm the newest member of the HelloAndroid.com team :)
Today we decided to update our Hello Baby widget, with a notification feature. So I'm using this opportunity, to show you how to use notifications with widgets.
The plan was to alert the user with a status bar notification 1,2,3 and 7 days before the days-left counter reaches 0.

Hello Money, earning tracking application released

One week after releasing Hello Money on the Android Marketplace, we have decided to remove the price tag and let the App Be downloded for free. Enjoy using it.
This widget lets you track your earnings if your are working on hourly basis. Set up your wage, currency and starting money. You can stop and resume the revenue counter any time making this widget ideal for anyone earning their money on hourly basis. It is also possible to place multiple widgets on the home screen with different setup and start/stop each with the proper buttons on them.

  

How to make Tabs UI with icons

SDK Version: 
M3

So here's how it's going to be look like:

Your class has to extend TabActivity:

  1. public class YourClass extends TabActivity {
  2. ...
  3. ...
  4. }

After that, here's how to configure a Tab:
1. Create a LinearLayout in your main.xml, with the id: "TabOne"
2. Paste these lines after onCreate() :

Developing a clothing game for Android

SDK Version: 
M3
What the hell am I doing? Developing a clothing game for Android...

Last time I was really bored, i tried to make a simple clothing game for android.

Here is the tutorial:

Mastering Android Widget Development - Part4

SDK Version: 
M3

As described in the previous part, we will use a Service to update the appWidget.
So we will have the Service below, which gets the command (right now we have only the update command), ant the appwidgetId, reads the date from sharedPreferences and updates the widget.

  1. package com.helloandroid.countdownexample;
  2.  
  3. import java.util.Date;
  4.  
  5. import android.app.Service;
  6. import android.appwidget.AppWidgetManager;
  7. import android.content.Intent;
  8. import android.content.SharedPreferences;
  9. import android.os.IBinder;
  10. import android.widget.RemoteViews;
  11.  
  12. public class CountdownService extends Service {
  13.         // command strings to send to service
  14.         public static final String UPDATE = "update";
  15.  
  16.         @Override
  17.         public void onStart(Intent intent, int startId) {
  18.                 //a command, to define what to do, will be important only in the next tutorial part, now there is only update command
  19.                 String command = intent.getAction();
  20.                 int appWidgetId = intent.getExtras().getInt(

How to optimize your android app's performance

SDK Version: 
M3

So here's how you can optimize, analyze your current application using TraceView.
Open your Project, and after onCreate(), or anywhere you want to start Log tracing, paste the following lines:

  1. /* start tracing to "/sdcard/filename.trace" */
  2. Debug.startMethodTracing("filename");

It is very important to stop tracing after you have done debugging. To do that, place these lines before onCreate().
  1. public void onDestroy() {
  2.         // stop tracing
  3.         Debug.stopMethodTracing();
  4.     }

Now run your Project, do anything you'd like to optimize, and quit. Open up DDMS File Explorer, and download /sdcard/filename.trace to your hard disk drive.

Go to your Android SDK folder, open Tools directory, and run ./traceview filename.trace

Here's how it looks like:

Syndicate content