ListActivity does the ArrayAdapter<T> class have to be an Inner Class

by David Parry » Fri, 23 Apr 2010 08:03:42 GMT


Sponsored Links
 Question:

I have a Concrete class that implements ListActivity in this class I
have an InnerClass extends ArrayAdapter<T>. This came from an example
and works great i.e. displays my list of items on the screen.

The problem is that I tried pulling out the InnerClass and use it as a
standalone Concrete class. So now I pass in the array of Items i.e T[]
to the constructor but when I set the ListActivity classes
setListAdapter(my pulled out InnerClass); the screen comes up empty?

So is this by design that ArrayAdapter has to be an InnerClass in the
ListActivity class?

If no then how can i get the list to display and update.

Thank you,
David

--



Other Threads

1. Disable screen saver on Android devices.

Hi,
such information as this is probably out here - but here comes a small
guideline (perhaps more suited for a blog - but anyhow - here we go).

We have received a question or two on how to programmatically disable
the screen saver in android devices.

If you are playing a video the the preferred way is to use the
MediaPlayer.setScreenOnWhilePlaying() method.

If that doesn't have the wanted effect or in other cases there is a
Power Manager API that can be used. 
http://developer.android.com/reference/android/os/PowerManager.htmland
the wake lock mechanism.

This mechanism must be handled with great care. There are two things
that really must be kept in mind.

1. The partial wakelock lets the CPU run even when the screen is off -
thus it may drain the battery easily if you not pay strct attention to
closing it.

2. Also note that you should ALWAYS decide if the wakelock that is
used needs to be reference counted or not, the default in Android is
TRUE. The normal and preferred settings is FALSE!

Example:

PowerManager pm = (PowerManager)
getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(
 
PowerManager.SCREEN_BRIGHT_WAKE_LOCK
                                      |
PowerManager.ACQUIRE_CAUSES_WAKEUP,
                                      "My Tag indeed");



w1.setReferenceCounted(FALSE);
wl.acquire();
   ..screen will stay on during this section..
wl.release();


For further information check:

http://developer.sonyericsson.com/wportal/devworld/article/newsandevents-latestnews-androidpower?cc=gb&lc=en

and

http://developer.android.com/reference/android/os/PowerManager.html

Kind regards
  /Johan
Sony Ericsson Developer Support #SEDW

-- 

2. Notepadv2

Hi,

I have a question (and possible bug) regarding Notepadv2, I searched
but couldn't find anyone mentioning this, so maybe I am missing
something.

In Notepadv2.java, onActivityResult() is a method which is called once
the subActivity returns. So, when NoteEdit "returns" or finish()'s,
this method is called. Looking at the source code you see a switch
statement on the ACTIVITY_CREATE and ACTIVITY_EDIT constants. Now,
these two constants are defined as ints 0 and 1, respectively.

OK, enough background. Now, when NoteEdit returns it does so with a
result code of RESULT_OK, which the API says is equal to -1

http://code.google.com/android/reference/android/app/Activity.html#RESULT_OK

So, how does the application work if ACTIVITY_CREATE = 0,
ACTIVITY_EDIT = 1 and the result passed back is -1?

What am I missing?

Thanks for the help


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

3. Icon design guidelines for Sony Ericsson X10 mini and mini pro

4. Psx4Droid!

5. Aktifin Flexi Unlimted di Samsung Momen

6. SDK addon for Sony Ericsson X10

7. New Developer Distribution Agreement