Activities and ListActivities with button and lists

by ~ TreKing » Fri, 23 Apr 2010 10:37:21 GMT


Sponsored Links
 



Cool, me too! Well, mostly buses, but same diff.



Sure you can.



No, you don't HAVE to, but extending ListActivity does simplify things if
your activity is predominantly list-oriented.



Crashes HOW? We can't read your mind (or code).

 By the way, if I put
"public class NextTrain extends Activity {"

Did you actually add a ListView to the Activity?



I can try.
If you extend ListActivity you can add a header view to your ListView
containing your two buttons.
Alternatively if you extend Activity, you can create a layout with your two
buttons and a ListView.



You're welcome in advance.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
 http://sites.google.com/site/rezmobileapps/treking 

--



Other Threads

1. MyLocationOverlay and enableMyLocation()

Hey Guys,

I've got a bit of a weird issue here.

In my activity, I've got MyLocationOverlay on top of my map and
enableMyLocation() in my onResume function. Funny thing is that when I
go to run the app in debug, enableMyLocation() returns false. I'm
targeting the Google Platform, and my Google Maps application
successfully takes location data from DDMS.

Can anybody think of a reason why enableMyLocation() would always
return false?

Thanks!

Evan
--~--~---------~--~----~------------~-------~--~----~

2. using attrs.xml

Hi,
i was wondering if anyone could give me hints on this one:
i created a new attrs.xml that adds some functionality to the soft keyboard
sample code.

i added: <attr name="keysImg" format="reference" /> to:

<declare-styleable name="Keyboard">
        <!-- Default width of a key, in pixels or percentage of display
width -->
        <attr name="keyWidth" format="dimension|fraction" />
        <!-- Default height of a key, in pixels or percentage of display
width -->
        <attr name="keyHeight" format="dimension|fraction" />
        <!-- Default horizontal gap between keys -->
        <attr name="horizontalGap" format="dimension|fraction" />
        <!-- Default vertical gap between rows of keys -->
        <attr name="verticalGap" format="dimension|fraction" />
         <!-- The global image used to crop keys from  -->
        <attr name="keysImg" format="reference" />
    </declare-styleable>

and added: <attr name="keysImgTemp" format="reference" /> to:
<declare-styleable name="Keyboard_Key">
.....
<attr name="keyIcon" format="reference" />
<attr name="keysImgTemp" format="reference" />
......
</declare-styleable>

in the xml file the data look like this:
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:jk="
http://schemas.android.com/apk/res/com.example.android.softkeyboard"
    ......
    jk:keysImg="@drawable/sym_keyboard_shift"
    >
and the key looks like this:
<Key android:codes="49" android:keyIcon="@drawable/sym_keyboard_shift"
jk:keysImgTemp="@drawable/keypad1low"/>

in my code i try to reference these values
 TypedArray a1 = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.Keyboard);//get all attrs for the keyboard as defined in
attrs.xml
THIS DOESN'T WORK! (has null value)
BitmapDrawable orgBmpDraw=
(BitmapDrawable)a1.getDrawable(R.styleable.Keyboard_Key_keysImg);

TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.Keyboard_Key);
//THIS WORKS!
BitmapDrawable orgBmpDraw=
(BitmapDrawable)a.getDrawable(R.styleable.Keyboard_Key_keysImgTemp);
//THIS DOESN'T WORK - has null value
BitmapDrawable orgBmpDraw=
(BitmapDrawable)a.getDrawable(R.styleable.Keyboard_Key_keyIcon);

what am i missing here?
thanks,

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

3. App not showing up in Android Market??

4. Where is the "Website" field in the Contact application?

5. Learning? Windows or Linux?

6. What the hack "UI language" is?

7. LinearLayout fill the middle