Activities and ListActivities with button and lists

by MyGB » Fri, 23 Apr 2010 08:05:42 GMT

Sponsored Links
 Hi everyone,
It's the first time I post here, so I hope I'll be clear for my

I'm developing a real-time informations about train. The application
will connect to a XML plateform that will give the next trains with a
station given.
I'm a beginner in Android development, and I'm stuck to a class-
problem (I think...).

In details, the problem is, when I start the application, the user get
a screen with 2 buttons, one of them get the user to a new screen with
stations list. But, my problem is, I can't put buttons and lists in
the same class.
I explain, to get a list on the screen, I have to put :
"public class NextTrain extends ListActivity {"
but the buttons function doesn't work (the app crashs).
By the way, if I put
"public class NextTrain extends Activity {"
the buttons works but not the list (no crash, but the screen doesn't
display anything).

Can you help me ?
Thanks in advance.

The Java source file : 
The Main.xml file : 
The Stations.xml file : 


Other Threads

1. virtual keyboard & EditText


I had an EditText that was working perfectly on the emulator.
Now that I am doing test with the htc magic (which has a virtual
keyboard) is giving me some problems:

this is the code that I use:

myEditText.setOnKeyListener(new View.OnKeyListener()
  public boolean onKey(View arg0, int arg1, KeyEvent arg2)
         do something...


The problem is that the inner function onKey() is only called() AFTER
the virtual keyboard is hidden, and for some reasons, I want to know
this as soon as possible...

does anybody knows how can I sort this out?


2. Why the Android docs are inconsistent?

I have looking for something and found these inconsistencies in the
online documentation

This is a snippet from FAQ section
        NotificationManager nm = (NotificationManager)

Now when I try to find the 'notifyWithText' api, I could not find it.

Another example is IntentReciever. I just want to know is this class
exists? As I found code in this forum itself using IntentReciever, but
I cant find this class in the doc.

And why standard intents like action
android:name="android.provider.Telephony.SMS_RECEIVED are not

3. What's the best way to handle an task w/progress dialog on orientation change?

4. Adding intent filter in code

5. UnLock screen is not coming when I building source and running the emulator

6. MemoryHeapBase Error + QualcommCameraHardware Error

7. how to get classes in an apk using DexClassLoader?