TabWidget demo project

Written by

in

,

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

Download tabwidgetdemo for eclipse

Comments

24 responses to “TabWidget demo project”

  1. Juan Avatar
    Juan

    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?

    Thanks for your help!

    best regards,

    Juan.

  2. mac Avatar

    Thanks very much.

  3. ASTX813 Avatar
    ASTX813

    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:

    Downloaded the demo app here, and the actual TabWidget via svn from google code
    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.

    1. Greg Avatar

      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

  4. Steve Gehrman Avatar
    Steve Gehrman

    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.

  5. Mac Avatar
    Mac

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

    1. Greg Avatar

      Hello, Download tabwidgetdemo for eclipse is posted at the end of this post.

  6. Bill Avatar
    Bill

    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

    1. Greg Avatar

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

      com.android.ide.eclipse.adt.ResourceManagerBuilder
      com.android.ide.eclipse.adt.PreCompilerBuilder
      com.android.ide.eclipse.adt.ApkBuilder

      That should take care of your problem

  7. Andy Avatar
    Andy

    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

  8. RickardL Avatar

    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!

  9. Steven Avatar
    Steven

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

    thanks =)

    1. Greg Avatar

      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

  10. Manikandan Avatar
    Manikandan

    How to download a Tabwidget Project

  11. kautilya Avatar
    kautilya

    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
    http://www.gregbugaj.com/wp-content/uploads/2009/06/tabwidgetdemo.zip

    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 .

    svn from code.google.com/p/androidtabs/

    svn checkout http://androidtabs.googlecode.com/svn/trunk/

    step 3. enjoy. 😉

    Thanks,
    kautilya

    1. Greg Avatar

      Thanks a lot for this great explanation.

  12. cullepm3 Avatar
    cullepm3

    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?

  13. cullepm3 Avatar
    cullepm3

    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?

  14. Alex Avatar
    Alex

    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
    ActivityThread.main(String[]) line: 4627
    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]
    Thread [ Binder Thread #2] (Running)
    Thread [ Binder Thread #1] (Running)

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

  15. Alex Avatar
    Alex

    Greg:

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

    Alex

  16. Nehatha Avatar
    Nehatha

    Hi Greg,
    Thanks for the project, very useful.

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

    Thanks
    Nehatha

    1. Greg Avatar

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

  17. worked Avatar
    worked

    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?

  18. Mr. Ed Avatar
    Mr. Ed

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

Leave a Reply

Your email address will not be published. Required fields are marked *