tommek

I just push the buttons….

Archive for the ‘Android’ Category

Getting Started Flex / AIR & Android

leave a comment »

If you have been thinking of porting your flex app to run on Android or have a idea for a mobile application which you want to develop in flex. Then to get started follow the links below.

First download Adobe Flash Builder “Burrito”: (This is the new Flash Builder which now has supports for mobile application projects)

Seconds download a sample app from “Christophe Coenraets“: (Use this app to learn about the new view structure etc and preview a working Flex / AIR app on your phone/emulator)

Advertisements

Written by tomkaurin

December 12, 2010 at 7:48 pm

Posted in AIR, Android, Flex

SQLite Browser tool for Android development.

leave a comment »

If you are developing an Android app that utilizes SQLite then you might want to install Questoid SQLite Browser. This is a eclipse plugin that will allow you to open the SQLite DB  file off the emulator.

1. Install Questoid SQLite Browser
2. Switch to DDMS perspective :

3. Open File Explorer:

4. Navigate to your SQLite file. should be something like data/data/<APP_PACKAGE_NAME>/database/<FILE_NAME>
5. Select the SQLite file and then launch Questoid 

Written by tomkaurin

November 8, 2010 at 6:27 pm

Posted in Android, Eclipse, SQLite

Improving your Android List Activity Performance with a ViewHolder

leave a comment »

I recently attended a Android developer lab at the Sydney Google offices. (ADL) Most of the day was about Android Market place etc but they did have one speaker Bill Laun who spoke about UI Best Practices & High Performance Apps. Most of the best practices talk was about design and graphics related to different screen sizes and dpi.

He did show us one thing that I found useful and had not heard of before and this was the “ViewHolder”. Using this strategy with your custom Adapter improves the performance for your List.

Every time your custom Adapter is executed the “getView()” method is called to get reference to your custom layout and populate it with data. If you have a large list, calling  “findViewById()” to access resource on every row will impact the performance of your list. So to get around this you can use a “ViewHolder” which basically keeps a object in memory with references to your row layout. This means you do not need to use “findViewById()”every time “getView()” is called but only once on the first call of it when the list is created.

public View getView(int position, View convertView, ViewGroup parent) {

		View v = convertView;
		ViewHolder holder;
        if (v == null) {

        	LayoutInflater vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        	v = vi.inflate(R.layout.article_row, null);

        	 holder = new ViewHolder();
        	 holder.title = (TextView) v.findViewById(R.id.article_title);
        	 holder.description = (TextView) v.findViewById(R.id.article_des);
        	 holder.date = (TextView) v.findViewById(R.id.article_pubdate);
        	 v.setTag(holder);
        } else {
        	holder = (ViewHolder) v.getTag();
        }
        Article article = articles.get(position);
        if (article != null) {
        	holder.title.setText(article.title);
        	holder.description.setText(article.description);
        	holder.date.setText(article.pubDate);
        }
        return v;
}
class ViewHolder{
	TextView title;
	TextView description;
	TextView date;
}

Written by tomkaurin

November 8, 2010 at 4:42 pm

Android Emulator ConnectivityManager, always returning connected

leave a comment »

I have recently be playing around with the ConnectivityManager in the android emulator. I was trying to detect if the emulator had internet connectivity or not.

ConnectivityManager connec =  (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);

connec.getNetworkInfo(0).getState() // = CONNECTED
connec.getNetworkInfo(1).getState() // = CONNECTED

Every time I retrieved the status from the NetworkInfo it would return “CONNECTED”, even when I disconnected from internet.

After doing some hunting around on the issue, I found that you need to manually disable the internet connectivity on the emulator. The emulator does not listen to the computers  network interface so disable the network / internet will not effect the emulator.

To disable internet / network connectivity on the emulator hit F8.

Written by tomkaurin

October 29, 2010 at 6:46 pm

Posted in Android, Emulator

Build Path Error, When creating first Android project

leave a comment »

Recently I start developing a Android App. After downloading the SDK, installing ADT pluging in eclipse and create my first every Android project, I was confronted with a project error even before writing one bit of code.

After doing some googling I found that by default eclipse treats incomplete build paths as an error.

To fix this all you need to do is:

Open eclipse preferences > Java > Compiler > Building and switch “Incomplete Build Paths” from “Error” to “Warning”.

I also noticed once you have changed this option to warning and your Android project is rebuilt, you can switch it back to “Error” and you will not get build path error any more. Even when you create new Android projects.

Written by tomkaurin

October 13, 2010 at 5:46 pm

Posted in Android, Eclipse, Error

iPhone4 vs HTC Evo

with one comment

This is a laugh got to watch!

Written by tomkaurin

June 30, 2010 at 1:21 pm

Posted in Android, iPhone

%d bloggers like this: