obtainStyledAttributes in monodroid - themes

I'm trying to replicate monodroid example for gallery tutorial.
But the example is missing one important point : how to set the background style of ImageView.
On Android tutorial we have the following code :
TypedArray attr = mContext.obtainStyledAttributes(R.styleable.HelloGallery);
mGalleryItemBackground = attr.getResourceId(R.styleable.HelloGallery_android_galleryItemBackground, 0);
attr.recycle();
....
imageView.setBackgroundResource(mGalleryItemBackground);
I have no idea how should I replicate it in monodroid !
Thanks in advance,
Alex

You can use the ImageView.SetImageResource(int) method to load an image from a resource Id.
Xamarin also has a Gallery sample up on their site that might be more useful to you than the Java version.

Related

How to display a KML (or GPX?) file on a Nativescript Angular app?

I'm trying to make an app using Nativescript-Angular that displays a route on a map like this : https://prnt.sc/10cy40s using .kml or .gpx files that I upload online somewhere else.
But I can't find anything regarding this with Nativescript-Angular or maybe I'm not asking the right questions ^^'
Thanks in advance !
Edit : To be more clear, I'm not expecting a magic answer, but more of a guidance about what I missed during my research.
There's no native KML support in the google-maps-sdk plugin, but what I did was extract the coordinates and create a polyline. This has worked well for me.

Confusing Dynamic Link Document

I tried to set up dynamic link to my iOS project and follow https://rnfirebase.io/docs/v4.1.x/links/ios document.
In document number 5. that need to update the AppDelegate.m file.
FIROptions defaultOptions].deepLinkURLScheme = CUSTOM_URL_SCHEME;
What is CUSTOM_URL_SCHEME ?
From the explanation : ^-- where CUSTOM_URL_SCHEME is the custom URL scheme you defined in your Xcode project.
I still really don't know where CUSTOM_URL_SCHEME is.
For someone who maybe like me non native developer from react-native.
Can refer to this link https://codorial.com/g/invertase/tutorials/ios-xcode-custom-url-scheme
And what I do is [FIROptions defaultOptions].deepLinkURLScheme = #"com.example.ios";

How to set Safe Area layout in iPhone x

I am developing Xamarin forms app and my app seems with safe area set in top. But need to ignore it.
Current scenario:
Excepted scenario:
I have googled regarding this and got below link, tried out as mentioned in below links and nothing worked.
https://forums.xamarin.com/discussion/104945/iphone-x-and-safe-margins-with-xamarin-forms
https://blog.xamarin.com/making-ios-11-even-easier-xamarin-forms/
But didn’t know how to access SetPrefersLargeTitles under Xamarin forms content page in below line mentioned in above link.
On<Xamarin.Forms.PlatformConfiguration.iOS>().SetPrefersLargeTitles(true);
After set safe area as true output come as below,
Please help me to resolve this.
Regards,
Cheran
You can do it from XAML like this
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
ios:Page.UseSafeArea="true"
Please Refer to Making iOS 11 Even Easier with Xamarin.Forms
We use Platform-Specifics to implement it.
Before iOS 11
On<Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true);
iOS 11 or newer
var safeInsets = On<Xamarin.Forms.PlatformConfiguration.iOS>().SafeAreaInsets();
safeInsets.Left = 24;
this.Padding = safeInsets;
It's necessary to create or configure LaunchScreend.storyboard.
Use this code, change splash_screen for your image.
Go to top constraint and make second Item constraint superview.Top
public ItemsPage() {
InitializeComponent();
On<Xamarin.Forms.PlatformConfiguration.iOS> ().SetUseSafeArea(true);
}

How to resize image file on Xamarin.forms. (+ writeableBitmap package can't be added)

I'm making iOS and Android app using with Xamarin.forms. (PCL project)
I need to resize my image file from 'MediaFile class' that is returned from 'CrossMedia.Current.PickPhotoAsync ()'.
What's your best way to do it?
and I have searched long time and noticed that many people uses 'writeableBitmap'.
But this 'writeableBitmap' nuget package can not be added because Xamarin platform is updated?
I got great answer from here.
https://forums.xamarin.com/discussion/comment/199212#Comment_199212
It's using DependencyService and it works beautifully.
After applied DependencyService, I got a question.
In my thinking, image file is not dependent so why don't we process it just in 'forms' using with SOME image process library in .net? (I'm not a .net developer but I believe that there is many library to process image file)
I suspect that we should have done because we want to use built-in image processing library(like UIKit) so that we could avoid adding new one?
Am I correct?

titanium studio save image into the native gallery

i would know if it's possible to save an image (from imageView, retrieve by webservice not from the camera) in the native gallery, both on ios and android ?
I suppose that yes, but i can't find the native gallery path to use for saving file (like Ti.Filesystem.externalStorageDirectory).
thanks
Yes you can do it. If you want to save the image into device's gallery you might use saveToPhotoGallery method:
https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Media-method-saveToPhotoGallery
If you want to save the file inside the device, have a look at this code snippet:
https://gist.github.com/timoa/3733505
#gsoulie Just have a look at my problem that I met before, Check Here! Hope this can help you!

Resources