platform specials

Broadcast receiver Activity

SDK Version: 
M3

If you want to catch a broadcasted intent on an Activity, you may get the following error:

  1. 02-22 08:18:46.874: E/AndroidRuntime(276): java.lang.RuntimeException: Unable to instantiate receiver com.helloandroid.broadcasttest.BroadcastTestActivity$MyBroadcastReceiver:
  2. ...
  3. java.lang.InstantiationException: com.helloandroid.broadcasttest.BroadcastTestActivity$MyBroadcastReceiver
  4.  
  5.  
  6. ...
  7.  
  8. 02-22 08:18:46.874: E/AndroidRuntime(276): Caused by: java.lang.InstantiationException: com.helloandroid.broadcasttest.BroadcastTestActivity$MyBroadcastReceiver

Android apps porting to BlackBerry PlayBook. It's easy.

SDK Version: 
M3

At the begin of February 2012 I’ve tested the BlackBerry Runtime for Android apps Beta which have shown up in end of 2011 to port our Bugzi application from Android to BlackBerry platform. The guys at RIM promise it’s easy. Let’s see, is it really easy?

At first we can choose three method to port Android applications: Eclipse plug-in, Online tool, and Command-line tools. I use the Eclipse plug-in, because we are programming in eclipse so it’s a clean choice. The little changes in code to make apps compatible with BlackBerry (it has some unsupported features and APIs from android. see later) is more easier with it, and you can test, and debug the code directly with BlackBerry PlayBook simulator, or real hardware.

Quick guide to quick autocomplete textview

SDK Version: 
M3

This demo shows how to speed up the original autocomplete textview assuming that we can work with ordered data.

Let's prepare a simple test environment, which demostrate the difference between the two versions. Then let's generate a few thousand test data, and create two textviews from which we will speed up the second one.

  1. public class Main extends Activity {
  2.         AutoCompleteTextView mAutoCompleteTextViewOriginal;
  3.         AutoCompleteTextView mAutoCompleteTextViewQuick;
  4.  
  5.         @Override
  6.         public void onCreate(Bundle savedInstanceState) {
  7.                 super.onCreate(savedInstanceState);
  8.                 setContentView(R.layout.main);
  9.                
  10.                 String[] values =  createLongSortedStringArray(4);
  11.        
  12.                 mAutoCompleteTextViewOriginal = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextViewOriginal);
  13.                 ArrayAdapter<String> originalAdapter = new ArrayAdapter<String>(this, R.layout.autocomplete_listitem, values);
  14.                 mAutoCompleteTextViewOriginal.setAdapter(originalAdapter);

Custom control states in library projects

SDK Version: 
M3

This is a tutorial about adding states to custom controls in library projects. So first, how to create and reference library projects: Setting up library projects, Referencing library projects.

Now that the project is setup you can start creating custom controls and states for them. This will all be inside the library project. Firstly you need to create an attributes xml file in values/attrs.xml (the name has to be attrs.xml) and adding the state:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <resources>    
  3.     <declare-styleable name="customTextViewState";>
  4.         <attr name="state_marked" format="boolean" />
  5.     </declare-styleable>    
  6. </resources>

Motorola Milestone CPU Overclock

SDK Version: 
M3

Use at your own risk!

milestone

OMAP3 processors used by the device are available. In this example,Milestone, Milestone 2, Droid, Droid 2 Global, Droid X, A853/A854. Other devices run this processor on higher frequencies, some even run it on 1,2 ghz.

The first step root. Superoneclick, it can be done in 5 minutes. 2.2.2 is no problem with it can be given to root. Click

The second step is to install overclock milestone.
Download: Click

Open Milestone Overclock and press the Load module. Set the slider to how you want to run.I recommend the 1GHz and stable.

Cloud to device messaging

SDK Version: 
M3

Android has so many features, that it's hard to go over every one of them. We wanted to try out cloud to device messeging (c2dm) for a long time now, and in the past few days I had some time to play with it. Here is a small tutorial on the topic.

How to draw multiline text to canvas easily

SDK Version: 
M3

There are situations where you have to use a Canvas. What do you do if you have more text than you can properly display?
The problem is, that if you want multiline text on canvas, with the drawText method, you would have to measure how much space a single line of text would take up, and also compare it to the width of the screen, and draw each line separately.
Read more to check my solution.

Android image processing (detecting motions)

SDK Version: 
M3

In this tutorial I'm going to show you how to process an image and draw it's color histogram.

First you have to create a new Android project with the following parameters.
Project name: ViewfinderEE368
Check the box for Android 2.0.1
Application name: Viewfinder EE368
Package name: com.example.viewfinderee368
Check the box for Create Activity and enter: ViewfinderEE368
Min SDK Version: 6

Project development using Google Code and Subversion

SDK Version: 
M3

Here is a little tutorial, if you want to check "Fancy time and date picker" by tamas!

Join to Google Code project from Eclipse

• Eclipse SVN plugin: Help-> Install New Software ...
Add a link to install Subclipse: http://subclipse.tigris.org/update_1.6.x
• Installing Subclipse
• Add SVN Repository: File-> New-> Other-> SVN-> Checkout Project from SVN
• Create a new repository location
• Copy the project SVN repository access

Fancy time and date picker

SDK Version: 
M3

The other day we needed a fancier than the factory default date and time picker, so I looked around the net, what other options are out there.

default datepicker

Syndicate content