Image Image Image Image Image
Scroll to Top

To Top

Blog

28

Dec
2011

3 Comments

In Android
FriendCaster

By Chris Banes

Android Bitmap Caching

On 28, Dec 2011 | 3 Comments | In Android, FriendCaster | By Chris Banes

Hey everyone,

This blog post has come about through a conversation between me and Ander Webbs on Twitter, about the usage of Reference and LruCache classes for Bitmap caching in Android. Here I’ll explain how FriendCaster caches it’s Bitmaps, and more importantly manages it’s memory so it doesn’t cause any OOM‘s.
Read more…

Tags | , , ,

23

Dec
2011

No Comments

In Pull-To-Refresh

By Chris Banes

Pull Up to Refresh!

On 23, Dec 2011 | No Comments | In Pull-To-Refresh | By Chris Banes

Hi everyone,

I’ve just added a new mode to the Pull-to-Refresh library which allows you to set the View to Pull Up to Refresh (from the bottom) instead of the standard Pull Down from the top.
Read more…

20

Dec
2011

2 Comments

In Android

By Chris Banes

Dangers of using WeakReference/SoftReference in Hash-based collections

On 20, Dec 2011 | 2 Comments | In Android | By Chris Banes

Hey everyone,

Just a quick post about something I saw this morning. In FriendCaster we use a HashMap collection of SoftReference’d Bitmap’s as an in-memory cache for images. This works fairly well as it means that we can get access to the bitmaps from memory (if they’re still in there). While looking through the source for Reference (super class of WeakReference and SoftReference) I saw that it does not override equals or hashcode.
Read more…

29

Nov
2011

2 Comments

In Pull-To-Refresh

By Chris Banes

New Pull-to-Refresh Library

On 29, Nov 2011 | 2 Comments | In Pull-To-Refresh | By Chris Banes

Hi everyone,

Over the past week or so I’ve been working on a new implementation of the Pull-to-Refresh widget for Android, as part of improvements for FriendCaster. The new library is based off Johan Nilsson’s library, but has changed a lot since then.

The way that the previous library achieves Pull-To-Refresh is via ListView HeaderViews which has certain drawbacks:

  • Hard to show/hide the HeaderView when you don’t have enough items in your list
  • Have to use ScrollListener, which is slow.
  • Only works with ListView’s.
Our new library is different because it’s actually a LinearLayout wrapper around an AdapterView, which hides/shows the Refreshing View. The end result has several improvements over the previous library:
  • Can be used with all AdapterViews (ListView, GridView, etc, etc).
  • Animated Scrolling for all relevant Android OS versions (tested on v1.6+).
  • Works properly when you don’t have many items in your AdapterView (no more ‘Tap to Refresh’).
  • Works just as well as the Official Twitter App’s Pull-to-Refresh in my opinion.
You can find the new Library here: https://github.com/chrisbanes/Android-PullToRefresh