we are currently working on a multi platform app for a university project and decided on using Xamarin. Our Database with sqlite as well as the business logic and shared resources should lie in xamarin forms, where as the View Controller and View are in the native xamarin.android and xamarin.Ios.
We can't seem to be able to use the Xamarin.Forms Images in the native ImageView on Android.
When going through the EmbeddedImages Section in the Xamarin Documentation (https://learn.microsoft.com/de-de/xamarin/xamarin-forms/user-interface/images?tabs=windows)
the following C# Code doesn't seem to work in our project.
var embeddedImage = new Image { Source = ImageSource.FromResource("WorkingWithImages.beach.jpg", typeof(EmbeddedImages).GetTypeInfo().Assembly) };
We can set the source to IamgeSource.FromResource("source") but typoeof(EmbeddeImages)... doesn't work. Even though the BuildAction is properly set to Embedded resource.
Also we can't really get the point of the "Using XAML" Section, where to put the C# code, as well as the XAML.
That's why we tried to convert the Xamarin.Forms.Image handed over from the logic into a bitmap using:
https://medium.com/#hakimgulamali88/a-helper-for-converting-a-xamarin-forms-imagesource-to-the-respective-native-images-56a5aaf98156
But when debugging the app turns black and the console shows multiple threats being started and finished. App stays unresponsive.
Are there any suggestions?
We appreciate any help. Thank you.
Related
I just finished my first Android Studio App with Kotlin. The Design/UI of the App is pretty lame, but works fine. Now I want to "upgrade" my UI with replacing/adding new Components that look better. I started reading about Flutter, but I only see tutorials where they start a complete new app from scratch. Since I got a working app, how can I simply only use the "design"-Options of flutter and let my source code be?
Im pretty new in this field, but got some C#-Experience but never did an App and since this is my diploma thesis, I just want to use all my resources so the App also looks professional in terms of UI-Design etc.
You can add flutter to existing android or ios app you can read here more.
how can I simply only use the "design"-Options of flutter and let my source code be?
Vanilla Android uses XML, however as you are likely aware thats not how it works in flutter. Since the system is completely different, I wouldn't expect you can just "change look" without re-designing it entirely with flutter.
If wanted to use flutter, I would assume you would need to add it incrementally (as mentioned in Gizmo1337's answer).
However if all you want is to update how your app looks, theres nothing stopping you from changing your existing XML style. I'd say it's probably pretty overkill to change to flutter if all you want is a new look.
I'm aware that when developing in Xamarin.Forms I have available some tools for hot reloading, such as:
https://github.com/AndreiMisiukevich/HotReload
https://marketplace.visualstudio.com/items?itemName=Xamarin.XamarinLiveReload
https://www.livexaml.com/
However I wasn't able to find an equivalent alternative for Xamarin.Android. Is there an alternative out there that I can use for hot reloading on Xamarin.Android?
There's two ways of creating a layout in Xamarin Android:
Using axml layouts - If you upgrade to the latest Xamarin & Visual Studio on a Mac, you will notice that the designer view for a layout gets updated in real time with the axml code. So technically it's live reloading.
Inside the fragment(CS file) - For this you can use Continuous, as you can see it in use here. Ryan Davis is available on Twitter, and he's pretty quick to respond
Here, I am adding the image for more clarification of my problem statement.
You're looking to create a share activity for your Android app.
react-native-share-extension should provide you with a good starting point (as well as providing support for iOS if you're working on a Mac).
I´ve set up a clone of this repo, and got it up and running at heroku:
https://github.com/dondido/webrtc-video-room
.. after trying about 15 others that I had various problems with. It works great under Windows in chrome and firefox, but when trying to access it with a webview on android in the app I´m developing (in B4A), I see only a grey screen. I do however manage to succesfully use https://appr.tc which is a very similar demo from google in the webview, so something should be amended in the android code. I think it relates to navigator.mediaDevices.getUserMedia, but I really don´t know what needs to be changed for this to function. I´ve been sitting and comparing the git repo for mentioned appr.tc but can´t nail the part that I have to amend. I am aware that I can just clone the appr.tc repo instead, but this one also needs GAE, which I want to avoid.
Any help?
Thanks!
I spent a week on this already, but I'm not an expert so I may miss something, or even want to do something impossible.
I have a Unity project (with Daydream VR) and my goal is to get a WebView working on a 3D surface (as a texture) in VR mode (for Android)
I know it sounds complicated and, I bet it is.
This is where I am so far:
First of all I started with the samples from Oculus. They made a plugin that links an Android MediaPlayer (native class from android) to a Unity Texture, this is kind of easy because the media player of android already use SurfaceTexture to render itself, and with the plugin they just created a bridge between the two environments.
I got this working easily.
Then after I found this article: http://www.felixjones.co.uk/neo%20website/Android_View/
and so I made a deduction that it could be possible to use the same trick to get a native Android WebView in a Unity Texture.
From the article, I thought that the only thing I needed was a custom Android WebView that renders to a SurfaceView (so it will be quite similar to the Android MediaView) and then the oculus plugin would work too.
Of course nothing was like that...
Step 1/
I made an Android plugin for Unity to expose a custom WebView that (IMHO) would render to a SurfaceView (but I'm not sure it is quite right)
see => JrmgxWebView.java
Step 2/
I compiled the oculus plugin, with minor changes
see => *.cpp
Step 3/
I adapted the Unity script that link both the Android plugin and the oculus plugin for unity, added that to a simple Daydream Scene on a 3D cube (with the script associated)
see => WebviewPlayerSampleWeb.cs
I get logs, and from what I understand, the problem is that the SurfaceView does not get refreshed. I can see that my Custom WebView is instanciated well, most of the code works and there are no error (nor crash)
But the texture only change from white (start value) to black (when the plugin is initialized) and then nothing happen.
The textureId coming from the plugin get stuck to either 0 or 29, and AndroidSurfaceTexture->GetNanoTimeStamp() never returns new values.
On the java side I played with .invalidate(), used .loadUrl() and .loadData() and on the C++ part, I checked each method call to see if everything was called. I spend so much time on this code that I can't even remember all the combination I tried.
What is wrong with this?
I'm sure I'm missing a basic point here.
most code here https://gist.github.com/jrmgx/019cba403769dda27a6d42e48c461b1b
PS: be nice with me, it's been a week, and it is my first time with Unity, C++, JNI and C#
Thank you in advance