TabHost and PhoneGap - android

I'm trying to add native tabs to my phonegap application on Android.
I have a way of doing it where each tab has it's own Activity and use loadUrl to load Phonegap in the view but it raises two problems.
I'm afraid the app is going to be
awfully slow if I have 5 tabs each
running Phonegap with some
javascript.
If I go back to a tab,
the last instance state has been
saved, so if i clicked on a link
from the tab, clicking back on the
tab doesn't load back the main page.
I'm thinking about creating a layout main.xml with a custom linear layout and some callback buttons to call something like : super.loadUrl("javascript: goTo page rand;"); but I'm not sure this is the best way since I would have to rewrite the tabs functionality and design.
Thanks !

Do you really need the tabs to be native because of some architectural constraint? If not how about using a framework like Sencha Touch which provides tab UI controls? There's a demo in the kitchensink code:
http://dev.sencha.com/deploy/touch/examples/kitchensink/
The framework works pretty well from what I've seen inside of Phonegap.

Related

Should I load fragments in a container or load new activities after BottomBar/tab click?

I am building a Xamarin Android app and need to make a design choice. I am still rather new in Android development, and don't know any other developers in my area personally that I can ask for help on this matter.
The app has a "BottomBar" with several buttons / tabs. If a button is clicked, a new screen should appear.
All 4 screens contain a lot of data, mostly lists (or RecycleViews?) of images with text and when clicking on a listItem or similar, an associated detail screen should appear.
At this point I wrote code that loads new activities when I click on one of the bottombar buttons. E.G., btnA loads activityA, btnB loads activityB and so on. The BottomBar is regenerated in each new activity and also keeps track of its instance State, so if I am in activityA and click on btnB, ActivityB loads and in activityB btnB is highlighted as the active tab, without me having to write a single line of code. Basically, this is working great out of the box.
I am wondering however if I should add a big fragment container in a host activity, and load different fragments in that container on BottomBar button clicks instead. Maybe this approach has a performance benefit or some other benefits that I am not aware of as yet. As for now, we don't have any intentions to create a tablet version, we only want to create a mobile version of the app. I understand that I can reuse fragments with a bigger screen estate (tablets), but this should not be necessary.
Again, everything is working ok as it is, but I am only at the beginning of building the app, and would like to make good design choices early.
The BottomBar component that I am using (Xamarin c#):
https://github.com/pocheshire/BottomNavigationBar
The above version is a port of this (Java):
https://github.com/roughike/BottomBar
Any advice is appreciated...
Sorry for long waiting.
If you want to follow the path that Google recommends in their guides that you need swap the fragments in the container by pressing the tab.
Link to Google guides

Android- Implement "Infinite" Slide Tab?

So I created a simple slide tab app using this reference via Android Studio: http://www.exoguru.com/android/material-design/navigation/android-sliding-tabs-with-material-design.html
The only difference between this and my app is that my app has more than 2 tabs (8). This is the link to my app via zip: https://www.dropbox.com/s/ipe4zz1u3r0lnqt/App.zip?dl=0
Anyway to the question. I am interested in implementing infinite scroll like this: ViewPager as a circular queue / wrapping
(The sliding tab continues after the end...|A|-->|B|-->|C|-->|A|-->|B|) So you can keep sliding right either in the page or in the tab.
However, I am not sure if or how it can be implemented as I am having a hard time understanding it. Any pointers/advice/clarification will be greatly appreciated as I am stuck.

open multiple tabs within one webview

I want to open multiple tabs within one webview. I can manage to load one url at a time. I am understanding that i have to customized my webview to do so. Is it possible, like as my below picture ?
Any suggestion , tutorial or guideline is appreciated.
Tabs are simply not part of WebView, you need to develop such features around it yourself.
E.g. you could use a TabLayout to implement the tabs, and update the state of the WebView according to the selected tab. You can easily find tutorials all over the place detailing tabs.

Dragging And Swapping tab Android

Hello Guys I am trying to implement tab dragging in one of my project that is supposed to run on android 2.2 or higher which is similar to Google chromium Desktop browser in dragging and swapping .
I have thought the following way to implement it which are as follow and
using the given logic http://jqfaq.com/how-to-drag-and-drop-replace-the-position/ with Linear Layout as vertical orientation and adding and removing element with gesture and animation
using Custom ViewPager and Fragments to achieve the same
Extending FrameLayout and adding and removing tab dynamically and when user press and start dragging then shuffle all the tab .. but this way in need to destroy and create all the visible tab again to give the same effects , with this way might work but mine progress and activity work will has to be recreated
Using Activity Group as Drag and Drop with view start from api level 11
i hope you guys got my problem and come up with suggestion and if have some ready made sample and best way to it

Android Layout Fragment/Activity Confusion

I am making my first android application with the ActionBarSherlock.
The application will always have an action bar consisting of 3 tabs (first tab selected by default).
The app could be extended for use with a tablet.
I have been searching the web, and following the android development guides, however I am finding a few things confusing.
The first tab screen will be a list view with a list of items, onitemselected should send the user to a screen which features more details about that item.
When should I use a fragment? Should each tab be a fragment?
Or, should each tab call a new activity, which consists of fragments?
And, if using fragments, should I place them in different classes, or embed them within an activity??
Appreciate any help, thanks.
you should probably read these two links first.
http://android-developers.blogspot.com/2011/09/preparing-for-handsets.html
http://android-developers.blogspot.com/2011/02/android-30-fragments-api.html
If you plan to make an app that work on both phone and tablet. It is a good idea to use a fragment, and then use a shell activity to wrap that fragment.
My experience with Fragments is mostly on ViewPager, so I am not entirely sure if it applies here.
In Android, you should use Fragments as much as possible. As a general rule of thumb, imagine you are translating the UI from phones to tablets, elements that can stay together in the same configuration should be a Fragment.
There is a Fragment subclass called ListFragment, so you might want to look into that for your first tab. (ListFragment is for Fragment like ListActivity is for Activity)
There is also a tutorial I found to deal with fragments. Did not really look into it but I hope it helps.
http://android.codeandmagic.org/2011/07/android-tabs-with-fragments/
As for ActionBar / ActionBarSherlock, I have absolutely no experience withit so someone might want to add to that.

Categories

Resources