# TabWidget demo project

Sorry it took little longer than expected, run in some issues with cupcake (SDK 1.5)
I have attached a Demo project for all interested with  some screenshots and modified .project for TabWidget Project(fixes cupcake problem ref http://groups.google.com/group/android-developers/browse_thread/thread/5537ae10e4143240) if you use eclipse.

1. My env:
Eclipse Version: 3.4.2
Android SDK 1.5
Windows

2.After you import the TabWidgedDemo project you will probably need to fix your buildpath.
Make sure to add TabWidet as a reference to TabWidgedDemo.

3.In TabWidged project you will need to update the .project file otherwise you will get Verify error when deploying to the device.

If you have any questions let me know, I hope you enjoy the project, more improvements to come

#### 24 thoughts on “TabWidget demo project”

1. Juan says:

Hi!
I am trying to execute the TabWidgedDemo, but I do not know how to add TabWidet as a reference to TabWidgedDemo. Can you please provide some step by step instructions?

best regards,

Juan.

2. Thanks very much.

3. ASTX813 says:

I hate to be another “why won’t it work” people, but, well… “The application Custom TabWidged (process com.gregbugaj.tabwidget) has stopped responding unexpectedly.”

I’m pretty sure I jumped through the right hoops to test out the demo:

Imported the Widget to Eclipse
TabWidget project properties – Android – Set build target to Android 1.5
Project refreshes and complains that TabWidget/gen already exists but is not a source folder. Fine, back to project properties – Java Build Path – Add Folder TabWidget/gen.
It generates the Java files in gen, and I get the problem “The type R is already defined” for the newly generated R.Java (there’s an identical copy of the same file in src/com.gregbugaj.tabwidget). So I deleted the hard-coded one and left the auto-generated one in /gen. Not sure that was the right action (after all, I couldn’t get it to work!), but it cleared out all the errors on the TabWidget project.
Then I imported the TabWidgetDemo project and it came in with no errors (but 2 warnings in the demo and 10 in the widget).

Definitely looking forward to your screencast, very much want to see this in action and try to implement it myself. Thanks for sharing it.

4. This is very strange, can you post or email me details of error and your platform. One of my friends used it this week with no problem, his was on Mac, eclipse 3.5 and Android 2.01

5. Steve Gehrman says:

doesn’t work.

Could not find TabWidgetDemoLauncher.apk

Is there no way of making this simpler? I’m a noob, but this should be simple.

6. Mac says:

So where can I find the TabWidget project? It doesn’t appear in the TabWidgetDemo project I downloaded from google code androidtabs…

7. Bill says:

Hi, took a while but I think I have everything setup correctly. However, I am getting that “VerifyError” you mention in your instructions. I am looking at the projects and can not find a “.project file” in either. I am new to Eclipse so maybe it’s staring me in the face. Could you elaborate on the instructions a but?

Thanks

8. Andy says:

Hi Grey:

I have been searching a round for a week now and this is exactly what I am looking for, Thanks for the Great demo, tha tab display great in the emulator and in the phone, will investigate more so that I can use this in my program, Thanks alot!

Thanks
Andy

9. You need to edit the .project file and comment out the following buildCommand’s

That should take care of your problem

10. Hi Greg, I’m playing around with the androidtab code base, I enjoy it so far, it’s a great improvement in usability. But right now I’ve struck a problem though, I might have missed something, but is there a reason why there’s an animation from right to left when switching between tabs?

Is this default to the android platform, and/or is it possible to change the behavior, either remove it or animate it upwards?

Keep up the good work!

11. Steven says:

Hello, how do I add TabWidet as a reference to TabWidgedDemo?

thanks =)

12. There are couple different ways of doing it.
Personally I like to download the source for tabwidget then reference that project from
project where I will be using the tabs. ON TabWidget Source project you will need to edit ‘.proect’ file and disable few features.

 FiveBrothersEngine <!-- com.android.ide.eclipse.adt.ResourceManagerBuilder com.android.ide.eclipse.adt.PreCompilerBuilder --> org.eclipse.jdt.core.javabuilder <!-- com.android.ide.eclipse.adt.ApkBuilder --> org.eclipse.jdt.core.javanature 

13. Manikandan says:

14. kautilya says:

Hi Greg,

Thanks a Lot for this valuable post and work.

guys it’s too simple to use..

Step 1. copy TabWidget Demo from here unzip it

step 2. download androidtabs code from google code project and copy both package from it’s src folder and paste in src folder of TabWidget Demo .

step 3. enjoy. 😉

Thanks,
kautilya

15. Thanks a lot for this great explanation.

16. cullepm3 says:

When I run the demo on 1.6 there are only 2 tabs after startup, home and edit. If I click the edit tab then it disappears the edit tab appears and is replaced with the help tab. On 2.2 the behavior is the same but with a jarring flicker. Is this expected behavior? Or are all 3 tabs supposed to appear on screen at once?

17. cullepm3 says:

When I run the demo on 1.6 there are only 2 tabs after startup, home and edit. If I click the edit tab then it disappears and is replaced with the help tab. On 2.2 the behavior is the same but with a jarring flicker. Is this expected behavior? Or are all 3 tabs supposed to appear on screen at once?

18. Alex says:

Greg;

I compiled both TabWidget and TabWidgetDemo, but attempt to run it immediately causes infamous NPE (Application has stopped unexpectedly…). Debug shows failure at line TabHostProvider tabProvider=new com.gregbugaj.tabwidgetdemo.DemoTabHostProvider(this); in the file TabWidgetDemoLauncher.java.

stack:
TabWidgetDemo [Android Application]
DalvikVM[localhost:8643]
Thread [ main] (Suspended (exception NoClassDefFoundError))
TabWidgetDemoLauncher.onCreate(Bundle) line: 15
Instrumentation.callActivityOnCreate(Activity, Bundle) line: 1047
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2627 ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2679
ActivityThread.access$2300(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 125
ActivityThread$H.handleMessage(Message) line: 2033 ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object…) line: 521
ZygoteInit\$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]

I would really appreciate your help! Thank you very much!

19. Alex says:

Greg:

I found my mistake (stupid one :-). Thanks for sharing your great job!

Alex

20. Nehatha says:

Hi Greg,
Thanks for the project, very useful.

One quick question, how to add a title for each tab, (similar to setIndicator())???

Thanks
Nehatha

21. Sorry, I haven’t have time to look at it yet.

22. worked says:

Hey Greg- I used Subclipse to add the TabWidget Project to eclipse via: http://androidtabs.googlecode.com/svn/trunk/. But I still receive this error “Failed to load properties file for project ‘TabWidget'”. Any help?

23. Mr. Ed says:

Is this project still up? Has it been updated to 2.X?