Hi,

I try to explain my problem hope someone can help me point out the causes.

I have a TabActivity that has 2 Tabs "MainApp.java" and "MethodB.java".
MethodB has code to populate a List, MainApp also populate the same content 
but 
filter out some column so from MainApp I call the method 
MethodB.Test(String).

I cannot get the list populated. If I tab on Tab "MethodB" first and return 
to MainApp Tab 
I got the list content correctly display in MainApp. 

-----MainApp.java------------------------------------------------------------------------------------------------------
/*
If I call Test(String) in MainApp "(MethodB.Test(String)", the listview is 
empty, if the list has been preciously initialise
in MethodB not calling from MapApp, the list is populated and if I call 
Test(String) now in
MainApp the list is good. 
*/

-----MethodB.java------------------------------------------------------------------------------------------------------
/*
The Test(String) can correctly populate InitialiseListView
*/
private static void InitialiseListView() {
events = new PasswordEventsData(mainContext);
try {
Cursor cursor = getEvents();
showEvents(cursor);
} finally {
events.close();
}
}

private static Cursor getEvents() {
//Perform a managed query. The Activity will handle closing
//and re-querying the cursor when needed.
SQLiteDatabase db = events.getReadableDatabase();
Cursor cursor = db.query(TABLE_NAME, FROM, null, null, null, null,
ORDER_BY);
((Activity) mainContext).startManagingCursor(cursor);
return cursor;
}

private static void showEvents(Cursor cursor) {
//Set up data binding
SimpleCursorAdapter adapter = new SimpleCursorAdapter(mainContext,
R.layout.itemname, cursor, FROM, TO);
((ListActivity) mainContext).setListAdapter(adapter);
adapter.notifyDataSetChanged();
}

public static void Test(String Type) {
                 InitialiseListView();
        }
----------------------------------------------------------------------------------------------------------------


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to