Click here to Skip to main content
15,314,644 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I've an application in which i want to show a list view that is displayed with in the tabhost having multiple tabs
the problem is that
the code i was using to bind the list view which was working fine when i was not working with tabhost is not working here


my code is
HTML
<TabHost
                          android:id="@+id/tabhost"
                          android:layout_width="600sp"
                          android:layout_height="wrap_content"
                          android:layout_span="3" >

                          <TabWidget
                              android:id="@android:id/tabs"
                              android:layout_width="600sp"
                              android:layout_height="fill_parent"
                              android:gravity="top" >
                          </TabWidget>

                          <FrameLayout
                              android:id="@android:id/tabcontent"
                              android:layout_width="wrap_content"
                              android:layout_height="300sp"
                              android:layout_gravity="center_horizontal"
                              android:paddingTop="40sp"
                              android:scrollbarAlwaysDrawVerticalTrack="true" >

                              <LinearLayout
                                  android:id="@+id/Notebook_Tab"
                                  android:layout_width="600sp"
                                  android:layout_height="fill_parent"
                                  android:orientation="vertical" >

                              <TableLayout
                                          android:id="@+id/DesktopTabListTableLayout"
                                          android:layout_width="600sp"
                                          android:layout_height="wrap_content" >

                                          <TableRow
                                              android:id="@+id/DesktopListTableRow"
                                              android:layout_width="wrap_content"
                                              android:layout_height="wrap_content" >

                                              <ListView
                                                  android:id="@+id/DesktopListView"
                                                  android:layout_width="wrap_content"
                                                  android:layout_height="wrap_content"
                                                  android:layout_span="4"
                                                  android:clickable="true"
                                                  android:isScrollContainer="true"
                                                  android:scrollbarAlwaysDrawVerticalTrack="true"
                                                  android:scrollbarSize="10sp"
                                                  android:scrollbars="vertical" >
                                              </ListView>
                                          </TableRow>
                                      </TableLayout>
                              </LinearLayout>
                          </FrameLayout>
                      </TabHost>



and code


Java
public void FillGrid(String s) {
    		clsDatabase dbh = new clsDatabase(this);
    		dbh.openDataBase();
    		Cursor cursor;
    		cursor = dbh.getGridData(s);
    		dbh.close();
    		if (cursor != null) {
    			int cnt = cursor.getCount();
    			if (cnt > 0) {
    				startManagingCursor(cursor);
    				try {
    				SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
    				R.layout.desktop_list, cursor, new String[] {
    			       AuditTab.KEY_ROW_ID, AuditTab.KEY_ID,
                                 AuditTab.KEY_SHORT_NAME }, new int[] {
    				R.id.txt_Desktop_ID, R.id.txt_DesktopID,
    				R.id.txt_DesktopModel });
    				adapter.setViewResource(R.layout.desktop_list);
    				lv.setAdapter(adapter);
    				lv.setTextFilterEnabled(true);
    				lv.setFocusable(false);
    				} catch (Exception ex) {
    					ex.fillInStackTrace();
    				}
    			}
    
    		}
    	}


The above function was working well when there was no tabhost but now it is not working and also there is no problem is getGridData() method rows are returning well but data is not binded by the adapter there are no any id related problem every thing is as it is as it should be Please help me out
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900