понедельник, 27 июня 2011 г.

Speed up your eclipse as a super fast IDE

Follow these 5 steps to speed up your eclipse as a super fast IDE , it works for 32 & 64 bit version eclipse/jdk.

1. Disable antivirus software, or add your jdk & eclipse & workspace & other related folder to white list in your antivirus software


2. Disable unecessary validations and startup action in eclipse reference.

пятница, 24 июня 2011 г.

четверг, 23 июня 2011 г.

Android: Use the ViewHolder

This is going to be a quick hit blog post about the Android "ViewHolder" pattern. To really make use of the ViewHolder with Android you do need to know what theListView widget is (a helper for managing views of lists), and that ListViews and generally backed byAdapters (adapters provide data for lists and build views for said data, they can be made from lists of stuff in files, or from in memory arrays, or from databases, and so on).

We will look at the code, complete with ViewHolder, coming up. First a bit more background.

среда, 22 июня 2011 г.

Asynchronous Lazy Loading and Caching of ListView Images

I am using a custom CursorAdapter for a ListView to display some images and captions associated with those images. I am getting the images from the Internet.
The implementation produced significant lag in the UI when scrolling through items. This is because the getView() method of a ListView adapter can be called one or more times each time a ListView item comes into view – we are given no guarantees on when or how this method will be called. Therefore, downloading images within getView() was extremely inefficient, as each image was being downloaded by the UI thread as the ListView item came into view, and was usually downloaded repeatedly after that.

Today I’ll refactor my app to add asynchronous lazy loading and caching of images. Some of the code included has been based on the excellent demonstration provided by Github user thest1. Through this example, I’ll demonstrate asynchronous operations in Android, using local storage for caching data, ViewHolders, and a few other advanced techniques for optimizing app performance.


Since all(downloading images) of this is happening on the UI thread, massive UI lag resulted, which would create a poor user experience for a production app. The root problems are:

  1. Images are being downloaded from the UI thread
  2. Images are being downloaded many, many more times than they need to be, since getView() is called as often as Android feels like calling it

So, what can we do?

среда, 15 июня 2011 г.

Using the Contact Picker. Getting phone and send sms

How to get email or phone from contacts and use it in your app?
This tutorial will start out simple, but then we’ll get in to some of the technical details of using Contacts with the ContactsContract class, which was introduced in API Level 5.

Step 1: Launching the Contact Picker

import android.provider.ContactsContract.Contacts;  
import android.provider.ContactsContract.CommonDataKinds.Phone;  

private static final int CONTACT_PICKER_RESULT = 1001;  
  
public void doLaunchContactPicker(View view) {  
    Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,  
            Contacts.CONTENT_URI);  
    startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT);  
}

Once launched, the contacts picker in your application will look something like this: