In IOS, the application window can render another UIViewController through the following.
application.viewController = (a new UIViewController)
application.window.rootViewController = application.viewController;
[application.window makeKeyAndVisible];
What is the equivalent in Android? I know that intents are used for firing new activities. Are intents right way to get the above IOS behavior in Android?
Related
Am I able to access UIKit through Nativescript or what ever the equivalent would be in Android directly from NativeScript code? For example, if I wanted to add a drop shadow to a UIView and add this view to the screen, would I be able to create a new UIView and programmatically add a drop-shadow if it's not supported in the XML and CSS implementations? I know they are supposed to have a 100% parody of the Native API's so it should be possible but just want to make sure as I'm having trouble finding examples in the docs.
Yes, you have full access to native objects for both iOS and android.
For example (taken from http://docs.nativescript.org/runtimes/ios/Overview.html):
Obj-C
UIView *view1 = [[UIView alloc] init];
// Or with the short-cut
UIView *view2 = [UIView new];
JS equivalent
var view1 = UIView.alloc().init();
// Or with the short-cut
var view2 = UIView.new();
Look around the runtime references in the docs as there are other examples of how do you operate with native objects for iOS/Android
navigation in Android TV.
How do I create just the navigation android tv. I do not care to use the entire theme, it provides android studio.
And I do not understand much of what is in the example given by android studio.
I understand that is something the String.
I looked on the internet examples, but right now, android tv has no further information at this time.
I'm interested only create menu navigation side, nothing more.
Thank you very much.
I found a really nice tutorial : http://corochann.com/browsefragment-header-customization-android-tv-application-hands-on-tutorial-17-697.html
it shows you how to create a custom navigation side with an image and a text
Here what a tried in my application :
copy his IconHeaderItem class and in your loadRows paste
IconHeaderItem gridItemPresenterHeader = new IconHeaderItem(0, BEWELL_THERMO, R.drawable.bewell_thermo);
GridItemPresenter mGridPresenter = new GridItemPresenter();
ArrayObjectAdapter gridRowAdapter = new ArrayObjectAdapter(mGridPresenter);
gridRowAdapter.add(DERNIERE_MESURE);
gridRowAdapter.add(GRID_STRING_GUIDED_STEP_FRAGMENT);
gridRowAdapter.add(GRID_STRING_RECOMMENDATION);
gridRowAdapter.add(GRID_STRING_SPINNER);
mGridItemListRow = new ListRow(gridItemPresenterHeader, gridRowAdapter);
mRowsAdapter.add(mGridItemListRow);
setAdapter(mRowsAdapter);
We're currently working on an app for one of our customers, and we've decided to use React Native as the technology to use for creating the app.
I'm pretty new to this technology, and I'm used to developing apps with either C# or Java, where I have full-fledged IDEs that provide all the functionality I need.
I'm currently creating a login screen, and would like to change to different views, depending on the type of login (e.g.: Facebook, Google, Twitter, Email, etc.).
How do I go about doing this. As I mention, with an IDE, it'd be a shortcut like SHIFT+ALT+A or something to create a new item, select type, name it and the IDE does the rest.
Do I have to create a new xx.android/ios.js file, and somehow call that, or do I need to go in to the native backend of the different projects?
What I tried was something along the lines of:
class Class extends Component {
render() {
<UI code here>
<Button onPress={this.eventHandler}
}
eventHandler(event) {
var xxLogin = new xxLogin();
xxLogin.render();
}
}
class xxLogin extends Component {
render() {
<UI code here>
}
}
But that failed, which I expected.
Thanks in advance for any help!
P.S.: I'm using Mac OS X El Capitan, if that helps.
I am working on a horizontal scrolling site and to add to it it has a couple of CSS animations that totally crash all the browsers on the ipad i am testing on, so I am wondering if there is a way for the code to detect mobile devices (iOs, Android..) over and above screen sizes, to just disable animation for it?
Thanks for all your help in advance.
I haven't attached any code to it because, I really do not know what I would use to detect the Os, I am aware of using media queries but as I said window size is not what I am looking for its the Mobile OS that I want to target.
You can use the navigator.platform property to check the device type, then use some javascript to add the stylesheet containing your CSS animations if it's not one of the excluded platforms.
For example, to load the animations for all devices besides iPads, you could do:
if(navigator.platform != 'iPad')
{
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'animations.css';
document.getElementsByTagName('head')[0].appendChild(link);
}
For a list of platform values, refer here:
What is the list of possible values for navigator.platform as of today?
For more info on loading a stylesheet with JS, look here:
How to load up CSS files using Javascript?
I need to make an app that will only display a public web url that mainly contains HTML, I want to be able to include back and forward buttons if a exact specific url is displayed or users can swipe from the side or something to display them (NO swiping from the side or bottom). I should be able to specify which domains and subdomains should be shown in the app and everything else would be opened in safari.
I would really appreciate if someone could find some kind of (free) solution or if they would like, they could make something for anyone else who is interested in having an Web Based App Template like this. Bonus points for Android and iOS versions and even more for iOS and iPad versions. Greatly Appreciated!
This would be quite easy using UIWebView (on iOS)...
define your webview inside let's say the main UIViewController
UIWebView *webView = [UIWebView alloc]init];
webView.delegate = self
[webView loadHTMLString:#"yoursite.com" baseURL:nil]
on the delegate you should implement
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if(request.url.absoluteString isEqualToString:#"any of the strings you want") {
return YES;
}
else {
[[UIApplication sharedApplication] openURL:request.url]
return NO;
}
}
code is actually not tested but something by this idea should work on iOS...
i only can help you with the iOS part though... hope this helps you...
PS: to use the back and forward you should create a UIToolBar with two buttons and enable and disable them using
if(webView.canGoBack)
backButton.enabled=YES;
if(webView.canGoForwad)
forwardButton.enabled=YES;
and this buttons calls the method goBack and goForward of the UIWebView..