[android-developers] ListView with massive number of items / How do I get the heights of items not currently displayed

2011-06-06 Thread irbaboon
I need to be able to browse quite a few items in my list (like
500,000). So I decided to use a strategy similar to the product list
in android market -- a Loading... item at the end of the list which
initiates downloading of more items when reached.

However, if the user keeps scrolling for a while, the items can become
too many to keep in memory (or even on the sdcard), so I made my
adapter use a circular buffer for the items with a capacity of 1000.
When the capacity is exceeded, new items overwrite the oldest items.
Then, I put a Loading... item at the front of the list as well, so
that discarded items can be downloaded again if the user scrolls back
to the top of the list.

I would like to keep the current scroll position unchanged when I add
new items. This seems to be the case when the capacity is not reached.
But when I reach the capacity and the oldest items are removed from
the adapter the list gets scrolled to the bottom which initiates the
loading of new items and this goes on forever. It seems that I need to
somehow compensate for the removal of items by scrolling up with the
sum of their heights. Is this a correct way of solving this problem?
How do I get the heights of the items?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to know if child activity exit by unexpected exception (onActivityResult() is not called)

2010-07-15 Thread irbaboon
I have exactly the same problem as you. And I made the same hack. It
works fine for the cases when the started activity crashes. However,
there is another case when onActivityResult() is broken:

-limit the number of process to 1 in dev setting
-start your activity
-let your activity call startActivityForResult()
-go to the home screen
-return to your task
-press back
-onActivityResult() is not called

The sub-activity has closed normally, so RESULT_CANCELED is not what
you want but you will get it if using the hack.

Android is so disappointing...

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] interprocess communication

2010-05-22 Thread irbaboon
Hi,

I'm developing an application which consists of two different
activities which edit files. The two activities run in separate
processes. Multiple instances of both activities can be launched
concurrently in different tasks. Each activity instance is passed a
file path to work on in its intent. I'd like to make it so that a
given file cannot be edited in more than one activity instance at the
same time.

As far as my understanding goes, I have to use a Service. Each
activity instance must ask the service whether it is allowed to
acquire the editing rights for the file passed in its intent. The
service will keep a set of open files. Set entries will be removed
when activity instances are closed.

The problem is that the service process can be killed at almost any
time. There is not any method like Activity.saveInstanceState(...) in
Service. How is the set of open files supposed to persist an eventual
killing and later re-launching of the service process?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en