background preloader

Android

Facebook Twitter

Volley

Developers. Grokking Android - Getting Down to the Nitty Gritty of Android Development. HMKCode | Code First! Programming tutorials. AndroidHive | Tutorials, Games, Apps, Tips | Android Adapter Good Practices « Piwaï.info. In Android, the standard way to display a list of items is to use ListView together with a ListAdapter. The ListView draws the currently shown items, and the ListAdapter provides the ListView with the View corresponding to each item. The aim is to create only the necessary number of views to fill the screen, and reuse these views as soon as they disappear. This article will explain various ListAdapter patterns and good practices. ArrayAdapter sucks Let's say you want to display a list of BananaPhone that can be updated. Some Android tutorials advise using an ArrayAdapter, because it is supposedly easier. ArrayAdapter has many limitations, which limits its use in real world apps. An ArrayAdapter: According to the Javadoc: Don't do this!

To use something other than TextViews for the array display, for instance, ImageViews, or to have some of data besides toString() results fill the views, override getView(int,android.view.View,android.view.ViewGroup) to return the type of view you want. Conclusion. Android. Android 2.2 was unveiled a few days ago at Google I/O and the SDK is now available for download. Android 2.2 offers numerous improvements and new features and there is one I would like to talk about in detail, the new Capture PSD tool. Capture PSD can be found in HierarchyViewer and requires an emulator or phone running at least Android 2.2.

If you are not familiar with HierarchyViewer, I encourage you to give it a try right now. It is an extremely useful tool to inspect and debug user interfaces on Android devices. The screenshot below shows where you can access this new feature; after loading a view hierarchy, simply press the Capture PSD button in the toolbar: With Capture PSD you can generate a Photoshop file from a running Android application. Each layer is named either after the id of the corresponding view, or after the class name of the view. The exported files are kept as simple as possible to ensure compatibility with as many applications as possible.