Lwuit: Use of PeerComponent - blackberry

I want to use a PeerComponent in my Lwuit application for using a native Blackberry Field like this example:
Player player = Manager.createPlayer("capture://video");
player.realize();
VideoControl vc = (VideoControl) player.getControl("VideoControl");
Field viewFinder = (Field) vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
player.start();
My problem is that my project is java-me (not Blackberry). Using a native RIM component don't compile my project. I need differentiate cases between Blackberry devices and other Java devices and in Blackberry case use a Field, How can I do? It's possible with a PeerComponent?

If you are using the new project structure generated by the GUI builder or manually as is done in the resource editor this should be very easy. In the new project structure the code of your application resides in a portable J2ME library project, the RIM/J2ME/J2SE/Android specific code resides in a separate project that just includes the library.
Once you do that you can define an interface to invoke a generic interface which you just implement differently for the platform specific code.
Alternatively you can always use a pre-processor and targets such as Netbeans allows, I understand Eclipse's mobile plugin has a similar facility as well.

Related

Show dialogs from JUCE library

I want to develop an iOS/MacOS app which would use Metal for rendering. This is not supported as a “main window” by JUCE (yet). The reason I was to use JUCE is because it unifies acquiring access to audio interfaces, which is quite different between iOS and MacOS (and also has a GUI component for configuring the audio source, which AudioKit doesn’t have, which is why I don’t want to use it).
I’m struggling to generate a project in JUCE that would have Metal-backed view as a main component. So I’m thinking to instead make a library using JUCE, and then make two native apps for iOS and MacOS which would both use that library. The library would be used to show the dialogs for configuring the audio input (and other parameters that I have, through custom components).
The question: is it possible to make a JUCE library which would be capable if showing dialogs (on both iOS and MacOS) to configure my app, and then use this library from the native iOS and MacOS apps that would have a Metal-backed main view?
Thanks in advance!

How to generate "platform.h" in a Xilinx SDK Project?

I'm currently working on a Zynq-7000 Software project using Xilinx SDK toolchain.
I've noticed that nearly all of Xilinx's Demo projects automatically generate a "platform.h" file. However, when I start from an empty project in the SDK IDE it never generates "platform.h". This normally this would not be a problem, however, I want to cut and paste code from the "demo" project into my empty application project, and I can't do this because the "demo" projects rely on the "platform.h" header file. (I could create the demo project and delete every file from it, except platform.h, except this solution doesn't work because I need to modify the hardware away from the defaults with a custom FPGA image.)
What's the secret to get Xilinx SDK to auto-generate the "platform.h" file for an empty SDK Application?
For instance, is there an obscure checkbox that I need to click somewhere in the Board Support Package Project that says generate "platform.h"? or something like that? no idea...
It turns out that "platform.h" and "platform.c" are just normal c-code that are part of the Xilinx demo project. This code is not generated automatically generated as part of the Board Support Package. Thus, you can simply cut and paste these files into your new project without causing any problems. This is why an empty Application project doesn't contain these files.
The reason why they called it "platform.h" was just to hide the API differences between different Xilinx CPU types. Thus, the same demo code compiles on multiple platforms.
If you are like me an only using the Zynq-7000 platform, you can simply delete everything else in the platform files that's not related to Zynq-7000.

Is there any class in MvvmCross that inherits from ActionBarActivity?

I'm developing an App with Xamarin.Android (aka MonoDroid), using the great MvvmCross Framework. The application uses Fragments, and need an ActionBar.
I've noticed that the MvxFragmentActivity inherits from MvxEventSourceFragmentActivity, and this last inherits from FragmentActivity, which has no ActionBar support. To support ActionBar, i need a class that inherits from ActionBarActivity, wich is included in the Support Library, and inherits from FragmentActivity.
So, my question is: Is there any MvvmCross class that Inherits from ActionBarActivity?
If not,
Can I just create a MvxEventSourceActionBarActivity and a MvxActionBarActivity that inherits from the first one, with just the same code of the MvxEventSourceFragmentActivity and MvxFragmentActivity just changing the inherits?
The basic answer is "No. There's no existing class. But I f you want to add binding to any Activity, then you can do so using 2 layers of inheritance - adding first an eventsource and then an Mvx layer"
There is a bit more detail about this in a few questions - eg ActionBarSherlock with latest MVVMCross
For the latest android support library, there is one issue to be aware of currently - when building binaries you currently either have to choose the mono library which gives you compatibility with play services or you have to choose the new Xamarin component which gives you the latest support lib - see MvvmCross - trying to use Fragments AND latest support lib results in linking problems and https://bugzilla.xamarin.com/show_bug.cgi?id=15205

Embedding Mono on iOS

I want to embed mono into my iOS application. I do not want to use MonoTouch. I want to embed mono manually like this:
http://www.mono-project.com/Embedding_Mono
I've have done this successfully on windows, using the above guide and various online examples, here's a good Windows one:
https://github.com/inkdev/Embedded-Mono-Sample
However I'm having trouble getting started on iOS. I know it can be done, companies like Unity3d use it to power their game engine tech. I can't work out how to compile and link mono for iOS nor can I find any good instructions to do so. I've not found any help using search engines, they exclusively seem to turn up articles about MonoTouch (Xamarin's own commercial wrapper around embedding mono into iOS).
Here's a few more noteworthy links:
http://www.mono-project.com/Mono:ARM
http://web.archive.org/web/20090106023130/http://mono-project.com./Mono:Iphone
Is there somewhere I can get precompiled libraries and headers for Mono for iOS, so in my C code I can simply link and include?
Could someone provide and example of how to compile mono for iOS ARM CPUs?
MonoTouch provides a great wrapper around all of the iOS Objective C APIs, however you don't necessarily need all of that, as I understand it should be possible to compile and then embed mono yourself and then use pInvoke to call the few native functions you will need.
Any help would be greatly appreciated, ty!
While not exactly what you are asking for, iOS 7 has added support for scripting with JavaScript. Many people finding this post may want to use this new capability to achieve what you are attempting. Link
As Rolf said, you need to read Mono Licensing document first. Embedding mono on iOS requires special permission from Xamarin.
You need to change several build settings from XCode, and here's what I did.
Open (or Create) iOS project
Add libmonoboehm-2.0.a to your project(You can use another version of .a file)
It's in Library/Frameworks/Mono.framework/Versions/{version}/lib folder
Project -> Build Settings -> Header Search
Add path: /Library/Frameworks/Mono.frameworks/Versions/{version}/include/mono-2.0
Project -> Build Settings -> Library Search
Add path: /Library/Frameworks/Mono.frameworks/Versions/{version}/lib
And, code like this in your iOS application
#include <mono/jit/jit.h>
#include <mono/metadata/mono-config.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/environment.h>
// ....
const char* dllFile = "ABSOLUTE_PATH_TO_DLL_OR_EXE";
domain = mono_jit_init(dllFile);
mAssembly = mono_domain_assembly_open(domain, dllFile);
// ... Do whatever you want :)
Please remember. You need to get license from Xamarin when embedding mono on iOS.
Enjoy :)

Use existing DLL in iOS app through mono framework

For one of my current iOS project, some business logic has been provided to me through a DLL and Native C++ binding code that i have to recompile in a dynamic library (dylib) and then use the DLL through this dynamic library.
Finally the DLL is used like this example:
int main(int argc, char** argv){
RTEnvironnement::CreateRTEnvironnement("../dll/RT.dll");
RT::RT_Facade * mFacade = new RT::RT_Facade();
RT::RT_Data_Projet * mProjet = new RT::RT_Data_Projet();
mProjet->Load_From_XMLFile(argv[1]);
...
Objects RTEnvironnement, RT_Facade, RT_Data_Projet are provided by the binding C++ dynamic lib. I cannot get the code of the base DLL and i have to use the DLL as it is on IOS.
I'm currently studying if mono touch can able my IOS app (basic iOS Objective C based on Xcode ), to launch the DLL that as been build with the standard mono framework. Before purchasing a license, I have to be sure that MonoTouch is able to do this.
Is someone do something similar ? Is there a simplest way to this ?
If i choose to use MonoTouch, can i keep my project in Xcode and just build the dylib in MonoDevelop and then import the lib the Xcode project ?
Thanks for your help.
the DLL that as been build with the standard mono framework.
MonoTouch (like Mono for Android) provide a base class library (BCL) profile that is similar (a superset) to Silverlight. However it's a subset of the whole Mono framework.
As such it's very common that assemblies compiled against the full framework won't work on MonoTouch unless they are re-compiled (against the MonoTouch BCL).
If i choose to use MonoTouch, can i keep my project in Xcode and just build the dylib in MonoDevelop and then import the lib the Xcode project ?
It's more complicated than that (e.g. MonoDevelop won't give you a .dylib). You might be able to google some instructions to do this, however be aware that this scenario is unsupported.
An supported alternative is to make MonoTouch drive the application, load any assemblies you need, expose those and then transfer control to your Objective-C code.

Resources