Image Gallery inside TAB

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Image Gallery inside TAB

Postby mailman » Mon Oct 27, 2008 11:33 am

Hello,

Anybody knows how to create an Image Gallery inside a tab?
I know how to create Lists or Buttons or Text but when I try to create an Image Gallery or a Spinner (of images) inside a tab ... it does not work.

The code I use for the tab is the following (as simple as possible):
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.        TabSpec ts1 = myTabHost.newTabSpec("TAB_TAG_1");
  2.        ts1.setIndicator("Audio", r.getDrawable(R.drawable.audio));  
  3.        ts1.setContent(new TabHost.TabContentFactory(){
  4.             public View createTabContent(String tag)
  5.             {                                            
  6.                 XXXXXXXXXXXXXX
  7.            }
  8.        });        
  9.                  
  10.        myTabHost.addTab(ts1);
  11.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


createTabContent contains the code to create the Gallery or Spinner (not included in the example since I used several files, one to create objects, another to order the images, etc.). It does not work (no coding errors, emulator is forced to close).

Should I use an Intent (creating a new activity for the Image Gallery) instead of creating a View with TabHost.TabContentFactory?

If anybody has any idea ....

Thanks
mailman
Freshman
Freshman
 
Posts: 2
Joined: Fri Oct 24, 2008 4:16 pm

Top

Postby mailman » Mon Oct 27, 2008 4:31 pm

I solve it !!!
I used Intent to create a new activity, which means, replacing the "tab" code as follows:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. tabHost.addTab(tabHost.newTabSpec("TAB").setIndicator("Image Gallery").setContent(new Intent(this, ImageGallery.class)));
  2.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


where ImageGallery is the file in which I implemented the Image Gallery.

Do not forget to modify the AndroidManifest with the new activity by adding:
<activity android:name=".ImageGallery" android:label="@string/app_name"/>

:)
mailman
Freshman
Freshman
 
Posts: 2
Joined: Fri Oct 24, 2008 4:16 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: abhinav123 and 4 guests