Android :: Creating Tabs For Calling Activities

May 5, 2010

I have some activities in my project like, Alerts,HomePage , Calculator etc. What i want to accomplish is to create tabs for all these activities and insert images for these. When we touch the tab the corresponding activity must load. I have done it using the menu options. But i must accomplish this using tabs. The tabs must also be at the bottom of the page... Should i create another class Tabs.java and tabs.xml or should i write tab host for each activity...?

Android :: Creating tabs for calling activities


Android :: Tabs - MapView - Activities Within Tabs

Oct 19, 2009

We're in the process of writing an app that has 4 tabs: Map, People, Places, Events. The People, Places, and Events in the App show up as Icons on the map. By default the People, Places, and Events tabs each show a listview, custom rendered, displaying all the People, Places, and Events respectively.

Now, right now each of the tabs has as its content an Intent set to launch the corresponding activity. For instance, there is a MapTabActivity that extends MapActivity, a ShowPeopleListActivity that shows the people, and so on and so forth.

I see a lot of StackOverflow questions/answers saying that due to various limitations in the way the TabHost is setup, it's best NOT to use activities as the content of tabs. For instance, it's impossible to launch a new activity and have it take the place of the existing activity within a tab, whereas it's possible to switch out a View with a different view.

Now, I'm at a crossroads. We've (for better or worse) devoted a fair amount of time trying to get this app to work the way it's currently structured, with the Activities as the content of the tabs. When an icon corresponding to a Person, Place, or Event is clicked, it fires off a VIEW Intent on a URI corresponding to that object; this is picked up by an Activity that then shows the object. The same mechanism is at work both in the Map and in the individual lists. We really like the loose coupling this provides us; we just give a VIEW command and the URI to the person/place/event and it automatically brings us to the right activity. Granted, the activity that's launched covers up the tab view rather than appearing inside of that, but we were willing to live with this.

Here's an issue though: from the Show activity, we want to be able to go back to the map, centered at that person, place, or event. We can launch a new activity to show the map again, but now we have the map activity as the content of the tab, plus the show activity, plus the new map activity in the activity stack; given how resource intensive the map activity is, I'm guessing this is not the ideal way to go.

I guess my question is, is there a GOOD tutorial somewhere showing exactly how to do complex tasks with a TabHost? I've seen HelloTabWidget; I'm looking for something much more sophisticated than this. I'm worried that if we switch to the View based way of doing things, we'll have to do a LOT of housekeeping to intercept all the back events, try to switch out the views, etc., etc., as well as strongly coupling our program in a way we don't want.

View 5 Replies View Related

Android :: Sub Activities In Tabs?

Feb 9, 2009

I have a tabbed applicationen setup. I like to keep the tabs visible at all times and work with its subactivites as 'more or less' standalone application threads.Within one or more of these tab subactivities, I'd like to start its own sub-activity, which should not hide the root tabs.Whatever I've found will call ctx.startActivity() which works, but will hide the tabs by using the full screen.Is there a way to limit the sub actitivies to a parent activities bounds, and keep (in my case) the rot Tabs visible? Where shall I look?

View 2 Replies View Related

Android :: Switching Tabs From Activities Inside Host

May 9, 2010

Currently I have a TabHost implemented with 3 tabs each containing a separate activity. My question is how do I switch between tabs from within one of the activities that is located inside the tab host. ie say i have a button inside one of the tabs[tab 1], when i click on this button it should switch to another tab[tab 2]. To understand my problem click on the link below, http://stackoverflow.com/questions/2541802/android-switch-tabs-from-w.

View 3 Replies View Related

Android :: Creating Options Menu Available To All Activities In Application

Jun 20, 2010

I want to have an options menu that is available to all Activities in my app (on pressing the MENU button). I've been doing this by creating it in onCreateOptionsMenu(Menu menu) for each Activity but this seems redundant. Is there a way to create it in one place and have it available in all Activities?

View 1 Replies View Related

Android :: Thread-safety When Creating Methods - Activities Which Interact With SQLite Database

Sep 20, 2010

I am creating an app which allows for many different Activities to be started from a TabActivity(up to ~25). Most of the activities require data from the sqlite database, so when onCreate is run, an AsyncTask creates an SQLiteOpenHelper object(which will open a readable/writable database), runs a query, data is retrieved, and everything is then closed.

I was just testing messing around to see if i could break something, so i added every Activityto the TabActivity's TabHost. I then started mashing each tab as quickly as possible.

I noticed that very quickly i began to see in the LogCat: Caused by: android.database.sqlite.SQLiteException: database is locked: BEGIN EXCLUSIVE; and the app proceeded to die.

Typically there will only be about 4-6 tabs(i can just limit the user anyway) for the TabHost. I haven't been able to break anything with a small amount of tabs to mash, but i am still worried that maybe i am accessing the database in a poor way.

How can i prevent my SQLiteDatabase objects to cause a lock?

If i create a ContentProvider will that eliminate the possibility of database locking?

Do you have any suggestions for changes I could make for accessing data from an SQLiteDatabase?

I ended up taking the approach of using the Application class and storing 1 SQLiteOpenHelper and trying my best to keep it synchronized. This seems to be working great - i put all my 25 activities in the TabHost and mashed away on them with no errors.

I am calling ((SQLiteDbApplication)getApplication()).setDbHelper(new DBHelper(this, Constants.DB_NAME, null, Constants.DB_VERSION_CODE)); method(shown below) in every onCreate() in my activities

Any further suggestions to this approach or to the changes i made using this Application class?

CODE:...................

View 3 Replies View Related

Android :: Scrollable Tabs - Dolphin Browser When Using Multiple Tabs

Jun 19, 2010

I'm currently working on my first android application. I am using a tabbed layout for my application. I followed the tutorial for this on the dev guide and ran into a problem. The tutorial only used three tabs, but I have a need for more. As such, the tabs resize and bunch up. I was hoping someone could tell me how I can make them scroll, like in dolphin browser when using multiple tabs.

View 1 Replies View Related

Android :: TABS In 2.0 Vs 1.5 - Rounded Corners TABS

Feb 27, 2010

I simply use the tabwidget :

CODE:..........

Why are my tabs so uggly in 2.0 (no more rounded corners as in 1.5/1.6) ?

ugly tabs here

=>

This was better

What should I do now to show "rounded corners" TABS to Nexus One (for exemple) users ;-) ?

Is it because of the following manifest lines :

CODE:................

I have to keep android:anyDensity="true" otherwise I've got a problem with re-sizing of the menus described here

As a separate question, my users can change the Locale within my app itself, I then "redraw" the menus using onPrepareOptionsMenu (Menu menu) to refresh the strings within the menu with the new language choosen by the user. Is there an equivalent for TABS (I have local strings within the Title of the TABS) or do I have to delete all the tabs and re-create them from scratch ?

View 2 Replies View Related

Android :: Tabs Layout - Tab Activity With 4 Tabs

Nov 11, 2010

I have an Tab Activity with 4 tabs. Each of tab is showing me the list view. Suppose i m on 4th tab and dragged the list view to the last position and after that i click on 3rd tab and again when i go to 4th tab it is not refreshing and showing me the last visible screen. Actually i want to show the list view again from 1st element. is tabs refresh automatically or we need to do it programmatic?

View 1 Replies View Related

Android :: Switching Activities / Passing Data Between Activities

Jun 30, 2010

how to call BarCodeScanner, and return the value to a field.so now, i have a toast that says "successful scan" and then i want to pass the result to a new activity. when i comment out my intent, everything works (minus the passing of data/switching of screen, obviously) but when i run my project as is, it FC's no errors reported by eclipse in code or xml. any insights?

View 2 Replies View Related

KitKat 4.4 :: Change Between Tabs By Swiping Left To Right To Change Tabs

Jan 10, 2014

i have a problem with this new kitkat os. Before kitkat i could change between tabs by swiping left to right ir right to left to change tabs.Now it doesn't change.

View 1 Replies View Related

Android :: Communicate Between Tabs

Feb 27, 2009

I am using a TabHost one tab with a list and another to show the details of a specific item selected in the list. Does anyone know how I can communicate between tabs?

View 2 Replies View Related

Android :: Tabs At BOTTOM

Mar 7, 2010

I've seen some chatter about this, but nothing definite. Is there a way to put the tabs in a TabWidget to the bottom of the screen? If so, how?

I've tried the following, but didn't work:

a) setting the tabwidget below the framelayout
b) setting the tabwidget's gravity to "bottom"

View 5 Replies View Related

Android :: Tabs At The Bottom

Apr 21, 2009

I have tabbed activity with tabs at the bottom. The labels of each tab are getting clipped unless I set the TabWidget too high (~60dip). My tabs don't have any icons. What is the trick to get the labels centered in TabWidget?

View 2 Replies View Related

Android :: Use Tabs In Application

Sep 8, 2010

I need to use Tabs in my application,I want to use tabs shown in the image attached with email.Could anybody please let me know how this can be done ,Is there any inbuilt control in android for doing this.Tab that are shown in the top and bottom of the screen.

View 2 Replies View Related

Android :: Last Two Tabs In App Doing Same Thing

May 10, 2010

I'm working on adding a tab to an application, but the last two tabs (regardless of order) are launching the same activity. If I go down to two tabs they both work correctly, but when I add the third the last two result in the same activity launching.

CODE:....................

View 1 Replies View Related

Android :: Tabs View App

Jun 3, 2010

I'm trying to build a tabs view for an Android app, and for some reason I get a force close every time I try to run it on the emulator. When I run the examples, everything shows fine, so I went as far as to just about copy most of the layout from the examples(a mix of Tabs2.java and Tabs3.java), but for some reason it still wont run, any ideas?

Here is my code(List1.class is a copy from the examples for testing purposes). It all compiles fine, just gets a force close the second it starts:

CODE:....................

View 2 Replies View Related

Android :: Tabs And Intents

Aug 15, 2010

I have a auto-complete textbox in which the user makes a selection. From here I want to load a tabbed layout which is based on the user selection. The problem is I cant figure out a clean way to pass that selection to each of the tabs. At the moment I can pass an intent to the 'tabhost' activity and then pass to each child activity explicitly, however this just seems like messy iterative code to me! So basically how can I pass my intent data bundles to the tabs activities cleanly & efficiently! Psuedo code is also very welcome.

View 2 Replies View Related

Android :: Tabs In The Same Activity

Aug 23, 2010

Where I can find a simple tabs example?

The Android Developers Hello Views Tab Layout example only details how to use separate Activities for each Tab.

I would like to use tabs to extend a screen of settings without scrolling, i.e. there are too many options for a single screen, so I'd like to split them over two tabs, but still handle them in the same Activity.

Each tab can refer to a separate layout file if that is how it needs to be done.

View 2 Replies View Related

Android :: Different Sized Tabs

Aug 24, 2010

I have an application with 4 tabs. By default every tab width is 1/4 of the screen width. How can I override this? I need the tabs to have a different width for each one.

View 2 Replies View Related

Android :: Using The Same View On Both Tabs

Oct 3, 2010

I'm working on an Android application with an activity that uses a tab layout. There are two tabs which switch between the content being shown in a ListView below.

This means that the two tab specifications point to the same ListView for content, R.id.main_list:

CODE:..................

This somewhat works - if I switch to tab #2 and back to #1, I can see the ListView and my database code gets the right data based on the selected tab. However, when the activity launches, the ListView can't be seen before tabs are changed. This is obviously a problem.

View 1 Replies View Related

Android :: Implement Tabs

Oct 7, 2010

How to implement tabs in Android. I am having a context. In that I want 3 tabs named Free,TOP,Paid.Clicking on each of the tab should open separate activity.

View 3 Replies View Related

Android :: Custom Tabs

Oct 11, 2010

I'm having a really hard time understanding how to use custom tabs in android. I don't want to just be able to set the text and stuff. How can I change the size, and the image, and all that.

View 1 Replies View Related

Android :: Create A Sub Tabs

Oct 11, 2010

I create a TabHost1 with 3 tabs: tab1, tab2, tab3. When choose tab2, I want the TabHost2 change into another sub TabHost with 2 tabs: tab4, tab5.

CODE:.............

TabHost2.xml is the same TabHost1.xml

When I choose tab2 the result like TabHost2 cascaded TabHost1

Actually I want the TabHost2 overwrite (replace) TabHost1.How can we do it ?

View 1 Replies View Related

Android :: Using Tabs And MapActivitys

Oct 26, 2010

How can i use tabs to switch between activities? For example i have some tabs, one of them includes google map and i want each tab to have its own activity with its own .xml file.

View 3 Replies View Related

Android :: Tabs In Every Activity

Nov 4, 2010

My first page contains 3 tabs. I want to retain all these 3 tabs through out my entire application. That means I want to see these 3 tabs in every view. For example : I have 3 views. First view is Main.class. It contains 3 tabs (Home tab, Favourite tab, settings tab). When I am clicking any one tab (Ex: Home Tab), it shows the contents of Home.class (a ListView) below these tabs. But when I am clicking the ListView view , it will go to another activity(SubListView.class), and I can't see the tabs in that activity. Only contents of that view will be displayed there. How can I show these header tabs in that view also?

CODE:.................

View 1 Replies View Related

Android :: Way To Display Tabs Throughout App?

May 5, 2010

I have created an apk which has activities. I have included tabs in my program through which the user can select the required activity. But my main problem is that i couldn't find a way to display the tabs throughout the application. For example, on clicking a tab the corresponding tab opens. But when i click on a button the activity is displayed but the tabs are not getting displayed. I have included a tabHost in the program to display the tabs for various activities.

View 1 Replies View Related

Android :: Lists In Tabs

Jul 12, 2010

I'm new to android development but I have run through various tutorials and am slowly grasping how to develop apps. I modified the Tab Layout tutorial on the android dev website to fit my needs, and now I need to add a list on to each tab I have created. there are a total of seven tabs and each will have it's on specific list. If someone could point me in the right direction to adding a list per tab that would be great. Each tab has it's own class file, would I add the list items as strings in the strings.xml then add code to each tab's class file in order to populate the tab? This was the only thing I have found so far, but it hasn't worked.

View 2 Replies View Related

Android : Can't Get Different Views In Tabs / How To Fix?

Dec 29, 2009

I have an app with 2 tabs, the first is a listview, and the second I'm trying to make a TextView. The problem is I have no idea on how to get the TextView to show up. The listview is working, but I can't get anything on the TextView at all. I tried using the Hello, World to try to work with the text into the tab, but I can't figure it out.

View 1 Replies View Related

Android :: Activity Based Tabs

May 11, 2010

I have Activity based tabs i.e i have used TabActivity,tabhost etc Now when we switch between the tabs, for the 1st time the oncreate is called and then after the onResume methode is called I want to know what event/function, of the activity, is called when i click on the the tab which is already selected. 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved