How can I dynamically add item to a Gallery in android

by ying lcs » Thu, 05 Mar 2009 09:03:11 GMT


Sponsored Links
 Hi,

Can you please tell me how can I dynamically add item to Gallery?
I have looked at ApiDemo and have studied their example.

But the ImageAdapter there is a BaseAdapter which has a fixed sized
array and the getCount() just return the length of the array.
My question is how can I change that to a dynamically size vector? I
have set breakpoints in getCount(), and it only called once
dynamically during initialization.  So how can I tell android that the
gallery size has changed?

Thank you.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Internet connection is not working in emulator

Hi,

I am not able to run the internet from my android emulator. whenever I try
to run my browser i am getting following error on various platforms

Following are some of the entries in log window.

*Android emulator 2.2:*
ERROR/ActivityThread(269): Failed to find provider info for
com.google.settings
onReceivedError -7
http://www.google.com/m?client=ms-android-google&source=android-home The
server failed to communicate. Try again later.

*Android emulator 2.1:*
ERROR/ActivityThread(114): Failed to find provider info for
android.server.checkin
WARN/Checkin(114): Can't update stat PHONE_GPRS_ATTEMPTED:
java.lang.IllegalArgumentException: Unknown URL
content://android.server.checkin/stats
ERROR/ActivityThread(114): Failed to find provider info for
android.server.checkin
WARN/Checkin(114): Can't update stat PHONE_GPRS_CONNECTED:
java.lang.IllegalArgumentException: Unknown URL
content://android.server.checkin/stats

ERROR/ActivityThread(229): Failed to find provider info for
com.google.settings
onReceivedError -7
http://www.google.com/m?client=ms-android-google&source=android-home The
server failed to communicate. Try again later.

*Android emulator 1.6:*
ERROR/ActivityThread(122): Failed to find provider info for
android.server.checkin
WARN/Checkin(122): Can't update stat PHONE_GSM_REGISTERED:
java.lang.IllegalArgumentException: Unknown URL
content://android.server.checkin/stats

ERROR/ActivityThread(122): Failed to find provider info for
android.server.checkin
WARN/Checkin(122): Can't update stat PHONE_GPRS_ATTEMPTED:
java.lang.IllegalArgumentException: Unknown URL
content://android.server.checkin/stats
ERROR/ActivityThread(122): Failed to find provider info for
android.server.checkin
WARN/Checkin(122): Can't update stat PHONE_GPRS_CONNECTED:
java.lang.IllegalArgumentException: Unknown URL
content://android.server.checkin/stats

ERROR/ActivityThread(302): Failed to find provider info for
com.google.settings
WARN/ActivityManager(77): Unable to start service Intent {
cmp=com.google.android.googleapps/.GoogleLoginService }: not found
ERROR/browser(302): onReceivedError -7
http://www.google.com/m?client=ms-android-google The server failed to
communicate. Try again later.

*Android emulator 1.5:*
ERROR/ActivityThread(640): Failed to find provider info for
android.server.checkin
WARN/Checkin(640): Can't update stat PHONE_GSM_REGISTERED:
java.lang.IllegalArgumentException: Unknown URL
content://android.server.checkin/stats

ERROR/ActivityThread(640): Failed to find provider info for
android.server.checkin
WARN/Checkin(640): Can't update stat PHONE_GPRS_ATTEMPTED:
java.lang.IllegalArgumentException: Unknown URL
content://android.server.checkin/stats
ERROR/ActivityThread(640): Failed to find provider info for
android.server.checkin
WARN/Checkin(640): Can't update stat PHONE_GPRS_CONNECTED:
java.lang.IllegalArgumentException: Unknown URL
content://android.server.checkin/stats

ERROR/ActivityThread(846): Failed to find provider info for
com.google.settings
ERROR/browser(846): onReceivedError -7
http://www.google.com/m?client=ms-null The server failed to communicate. Try
again later.

Please let me know if any one has having any solution for this issue

Thanks in advance
-- 
Regards,

Viral Brahmbhatt
(M): +919998999518

-- 

2. android design considerations: AsynchTask vs Service (IntentService?)

I'm designing an android app which will need todo the following steps:

   1. user pushes a button or otherwise indicates to "synch data".
   2. synch process will use REST web services to move data to and
from the server.
   3. the data will be stored locally in a sqlite database.
   4. the synch process should provide status updates/messages to the
UI
   5. the user should not be allowed to wander off to other parts of
the application and do more work during the synch process.

The first time the synch process runs, it may take 10-20 minutes.
After the initial synch, less data will be transferred and stored and
I expect the process to take 1-2 minutes or less.

I've been doing a lot of reading about android's AsychTask and various
examples of using a Service ... But I don't fully understand the
design considerations and trade-offs of choosing one design over the
other. I currently have my demo project stubbed out using an
AsychTask. After watching (most of) Developing Android REST client
applications: 
http://code.google.com/events/io/2010/sessions/developing-RESTful-android-apps.html#
I'm left confused the design patterns described here feel overly
complex, perhaps because I just "don't get it" yet.

Would love to hear from some more experienced android developers out
there who have already wrestled with these questions.

-- 

3. Accessibility question

4. Compressing camera image to a certain size

5. How to make a map move as you drive?

6. bitmap magnification

7. how do i add the content view behind gridview?