This seems crazy. I must be missing something. When setting location fragment in Android Browser (ICS, 4.0.3), the location bar fails to update to show the new fragment. Seems to fail equally whether setting window.location, window.location.hash, or a plain old <a href="#foo">. The browser does indeed navigate to the desired fragment, and on refresh, the location bar contains the fragment as expected. And the back button works! The only thing wrong is that the displayed address in the location bar should reflect the new location+fragment immediately, but it does not.
Good example can be seen at Google Closure goog.History demo page.
We noticed this too in Android 4.0.4.
Even worse is that at least on one Device (Galaxy Nexus) the hash navigation breaks if the url only contains a path e.g. http://www.example.com/path/. You can then navigate to fragment urls just fine, but tapping the back button has no effect.
The problem is fixed when a file is present in the url.
# will fail when using browser back button
www.example.com/path/
# will work although no fragment is shown
www.example.com/path/index.html
Related
In my Codename One app I have 2 Forms A & B. A Form includes a MapContainer updated every 10 s and a floating button. If the user clicks on the floating button, they can take a picture and then a Dialog is shown and if they choose "OK" the B Form is shown :
new B_Form(theme).show(); // (where theme is the Resources used in A Form).
This B Form includes buttons to take some action (ie record audio, play the recorded audio, go to Form A). The buttons work in the simulator (although recording is not supported so an error is shown but it is expected), that is the user can click on it.
However on an actual device (Android KitKat) B Form is shown but no action can be taken although the buttons are all enabled. The buttons even don't show their "pressed style" when being pressed, and remain in "unselected state".
The only button that works is the setBackCommand from the Toolbar (ie the left arrow on the upper left corner of the screen).
So it looks like the B Form was not taken into account. Moreover if I swipe my finger on the B Form then A Form is shown and the map is moved. If I removed the MapContainer from the A Form then B Form works as expected on the device.
EDIT
Surprisingly enough if I call a Form C from the side menu bar via the hamburger menu, the buttons on that Form C work seamlessly!
So I get the feeling that the MapContainer is causing me trouble, what can I do to make B Form work as expected ?
Any help appreciated,
Regards,
The MapContainer is a peer component, we enabled the new peers on Android which hide some of the complexities of the peer system but might trigger other issues.
This might be a misbehavior of the peer component system, although it's hard for me to understand how to reproduce this. The side menu would work because the side menu is a completely different form without the map container in it.
So here is the workaround I found.
Before showing Form B, I removed the MapContainer and revalidated the Form A :
googleMap.remove(); // googleMap is my MapContainer defined somewhere else
this.revalidate();
Although it works I still don't understand why the problem described in the question happens.
I've been trying to create an app that uses the FragmentStatePagerAdapter, TabLayout, and Fragments. My goal is to have an app that functions as described below.
[App]-->
-->[Tab1 Default View]-->ChildFragment-->ChildFragment
-->[Tab2 Default View]-->ChildFragment-->ChildFragment
-->[Tab3 Default View]-->ChildFragment-->ChildFragment
So, when the app loads, it would show Tab1 by default. Tab 1 would have it's "Root" view, and when I load a new "screen" from within it, it would nest the screens inside the Tab1. So if Tab1's title was "Tab 1" it would show that by default, but then if I click a button to load a new screen in tab 1, it would show the title as "New screen" and the back arrow would appear, which on click would take me back one level to the root view.
I've tried following the tutorial here...
https://tausiq.wordpress.com/2014/06/06/android-multiple-fragments-stack-in-each-viewpager-tab/
However, it's FULL of errors and will not even compile in Android Studio newest version. Can anyone provide a short and sweet example project or even a link to a working example that I can follow?
My app has always worked fine using ActivityGroup class, but since it has been deprecated since Api 13 I feel I REALLY need to update my app so it continues working in future Android versions.
Help please!?!?!
I have created an app that gets a list from a website and stores it in the cache. These values are then displayed in a tab. Each value gets put into a TextView that is created when the Fragment is created. That part works perfectly fine, even when I don't have an internet connection (so it is relying on what was stored in the cache).
I have found that if I let the app sit for a while, just using my phone as normal, when I go back into the app that tab is blank. I'm not really sure what the problem is since I don't get any error messages. If I go to the app chooser and swipe the app closed, the next time I run the app it goes back to the splash page and everything works great. Am I missing something to be able to have a view that I created programatically be able to be stored in memory?
You will have to explicitely save the contents of your TextViews, and in general any view that you wish its contents to remain after an onPause of your activity. Specifically for TextViews you can do that in your xml definition by adding
android:freezesText="true"
If you add your TextView programmatically, you can try this:
textView.setFreezesText(true);
I am doing some pretty basic html displays using WebView and all is working well. One thing that I would like to do is as the user navigates between pages update the application label. I believe I'm calling it the correct name as Application label. This is the area where your string app_name is displayed via the manifest.
So anyway I would like to update it to say the tag of each page but I am not sure where to begin researching that type of interaction if it's possible. The other option as I've seen others do, but don't know how is to get my WebView to cover the application label area..or remove it or whatever it is they do. Once removed I'll just add a to my page displaying the .
TIA
JB
This is the area where your string app_name is displayed via the manifest.
My guess is that you are referring to the title bar (on older devices) or the action bar (on newer devices, plus older devices using ActionBarSherlock).
You can modify the text displayed there by calling setTitle() in your activity.
I have implemented my own manual method of switching the app's localization within the application without having to modify the device's localization settings. The user either clicks on a tabbed bar via a set of right nav buttons on iOS devices, or use the native menu on Android devices to select the desired language.
This method works great on iOS devices. It almost works great on Android devices in that all text labels are immediately set to the respective language after the user makes their selection. However, the native TabGroup tab titles are not changing on my Android devices. They change immediately on my iOS devices.
I've tried many different methods to try and work around this. I tried removing the existing tabs from the TabGroup, but Android doesn't support this, at least not while using Titanium. I tried closing the tabGroup then re-opening it, but this just causes my app to lock up. I also tried looping through all my tabs and setting the titles that way to no avail. I also attempted to use the splice() command on the tabs array of the tabGroup, and that just throws a TypeError complaining about not finding a default value for object.
This is becoming very frustrating. I've looked at custom tab options available, including the Titanium Marketplace module called Tabulous. I've not been thrilled with any of those alternatives, particularly with their poor horizontal layout performance or reliance on using images instead of a mix of images and text.
One thing I do know is that on Android devices, my tab titles are being changed, because, within my event listener where I set the tab titles on language selection, I can loop through the tabs in my tabGroup collection and output the titles which reflect the chosen language. However, Android for some reason does not redraw the tabs to show the new text.
Here's a snippet of my event listener where I set the tab titles:
Titanium.App.addEventListener('langChanged', function() {
homeTab.title = al.L('home_win_title');
servicesTab.title = al.L('services_win_title');
mediaTab.title = al.L('media_win_title');
contactTab.title = al.L('media_win_title');
// Android test:
if (Ti.Platform.name == 'android') {
for (var t in tabGroup.tabs) {
// The alert below returns the expected title based on the language selection!
alert(tabGroup.tabs[t].title);
}
}
});
As I said, on my test iOS devices, the tab titles are updated as expected. On Android devices, they do not change (are not re-drawn), though the alerts I throw in the above loop show the correct text.
Any ideas, anyone?
I ran into the same issue while also trying to support multiple languages in an app, and this post on the Appcelerator Q&A site appears to confirm that it's not possible to change the tab title on Android.
However I got around this problem by closing the tab group and opening a new one - so it is possible to do that, and it may be that you need to refactor some of your app to prevent the locking issue you mention.