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
problem.

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 :  http://pastebin.com/RwHyi299 
The Main.xml file :  http://pastebin.com/A1avkfZc 
The Stations.xml file :  http://pastebin.com/1firyRhB 

--



Other Threads

1. Google Map Directions

I want to show the direction with arrow using google map between two
locations in my application.
Please help me in getting working code/API

-- 
Best Regards,
Virendra Patidar
Cell #  09910288925

-- 

2. Opening new package to current view

Hi, I have a problem when loading a new package to current view. It
doesn't find the libraries which the new package has. How to overcome?

This is my code:

public void onClick(View v) {

                                        contentLayout =
(LinearLayout)findViewById(R.id.contentLayout);

                                        contentLayoutParams = new
LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
                                        unregisterReceiver(mBatInfoReceiver);
                                        Intent intent = new Intent();
                                        intent.setClassName("com.centria.news",
"com.centria.news.News");
                                        startGroupActivity("activity1", intent);


                                    }

public void startGroupActivity(String id, Intent intent)
        {
            contentLayout.removeAllViews();
            activityManager = getLocalActivityManager();
            View view = activityManager.startActivity(id,
intent).getDecorView();
            contentLayout.addView(view, contentLayoutParams);

        }

It loads the view and shows it, but then crashes. The news code has a
webview in it.

LogCat report (errors):

04-20 10:21:06.273: ERROR/Database(17654): sqlite3_open_v2("/data/data/
com.centria.news/databases/webview.db", &handle, 6, NULL) failed
04-20 10:21:06.313: ERROR/Database(17654): sqlite3_open_v2("/data/data/
com.centria.news/databases/webviewCache.db", &handle, 6, NULL) failed

and de{*filter*}:

the source attachment does not contain the source for the file
Webviewdatabase.class
the source attachment does not contain the source for the file
cachemanager.class
the source attachment does not contain the source for the file
handler.class
the source attachment does not contain the source for the file
looper.class
the source attachment does not contain the source for the file
handler.class

Program works fine if I start it to its own view.

-- 

3. AlerDialog inside onRecieve

4. Tutorial: Android Service Component

5. What does the icon means on status bar?

6. Why my maps api didn't work?

7. Private Clipboard per Activity and/or App?