:) :) Okay so I am new to LaTeX and Android (So don't hate me please). I am currently working on a project that involves the MimeTeX library working in an android application. (MimeTeX is the LaTeX library ported for android.)
Seeing that MimeTeX is written in C you have to use the native development kit.
I have the following in my main activity:
public native subraster rasterize ( char expression, int size );
static
{
System.loadLibrary("mimetex");
}
Now Eclipse is telling me that 'subraster' cannot be resolved as a type. So can anyone maybe help me and tell me what do I have to add to my MainActivity (in Java) for the subraster type to be valid? I have already configured all the paths and included the ndk-build.cmd to the build path of the C/C++ compiler.
Thank you, and I am sorry, but I am new to this. :) Even links with relevant information would be helpful (If you can find any)
Related
I'm building an Android app in Xamarin.Android. In Java terms, I need to import android.support.design.widget.CoordinatorLayout;. How can I do this with a C# using statement?
Xamarin intellisense won't let me go past using Android.Support. When I add .Design it tells me the using directive is unnecessary, and throws build errors.
Can you please help me?
It sounds like you're missing a component. Try including the Android Design Support Library component, I think it'll fix your problem.
If that doesn't work, try the steps listed in this question.
Double click on your packages folder inside your Xamarin Android project. The NuGet package search window will appear. In the search field (top right corner) type "Xamarin.Android.support.design". Select the package from Xamarin Inc.
Also helpful might be Xamarin.Android.Support.Contraint.Layout and Xamarin.Android.Support.Contraint.Layout.Solver. These are pre-release packages so you need to check the "Show pre-release packages" checkbox.
Use using Android.Support.Design.Widget; and make sure you're using the Xamarin.Android.Support.Design package from NuGet.
I have an Application based heavily based on SLD2, and I would like to port it on Android(Its currently available for Windows, Linux, MacOS and iOS).
After doing a lot of research the cleanest way I have found was to use the Android Native activity and start my C++ code from there. That worked great, my next step was to build SDL2 as a dynamic library and included in the project which also worked fine. Although when I tried to Initialise SDL video, sound etc. I found out that SDL2 can only be Initialised inside the SDL_Activity provided by the SDL source code.
Is that true?
Is there a way to do what I am trying to do?
My code base is quiet big and replacing the main class that takes care of the SDL rendering, with a java class will affect a lot of my base code.
Is there an other alternative or a guide to get inspiration?
I am having trouble with nonfree methdos usage in android. SIFT and SURF methods are not included in opencv-android-2.4.8. They are needed to be complied seperately.
https://sites.google.com/site/wghsite/technical-notes/sift_surf_opencv_android
This is the main tutorial about nonfree module compilation. However, the jni part for java users are not included. I have searched how to use compiled .so libraries but I could not achieve.
I wonder that someone can share the jni part for nonfree modules or detailed explanation for it, because I work on that issue over a week and I could not do it.
Thanks.
I am the author of the tutorial. I will be adding another tutorial showing the JNI part. Hope that will help. Please go back and check the tutorial in the next couple of days. I will post it soon.
I solved the problem. When you follow the tutorial(the link given in the question) you get the necessary libraries(.so files). In order to use them in java you do not need to implement jni part. When you load the libraries in your java code (System.load(libraryName)), then you can use sift and surf methods like the other detectors or descriptors. You can directly use the code pattern supplied by the opencv-2.4.8.
Assuming that you've already gotten OpenCV 4 Android to work on your Android device;
1) I placed libnonfree.so, libopencv_java.so and libgnustl_shared.so (not sure if the last one is needed) in the correct folder for your platform, in my case jniLibs/armeabi-v7a. Already compiled version can be find in the demo folder here; https://github.com/bkornel/opencv_android_nonfree
2) Make sure you load both libraries.
static {
System.loadLibrary("opencv_java");
System.loadLibrary("nonfree");
}
This was all that was required in order for it to work for me.
#fetifati, Do you mean to say that if I copy libnonfree.so and libopencv_java.so in say lib/armeabi folder and do System.load("nonfree"); System.load("opencv_java"), I can use code like:
private static final FeatureDetector detector = FeatureDetector
.create(FeatureDetector.SIFT);
private static final DescriptorExtractor extractor = DescriptorExtractor
.create(DescriptorExtractor.SIFT);
directly ? ... It doesn't seem to work for me. I am getting some errors.
I recently created a project in Netbeans using VirtualBox on which i installed windows XP (Not activiated)
My Windows required me to activate and would not allow me access to my files on the computer before i activate it, i stupidly went and uninstalled XP and reinstalled it, thinking i'll have access to all the files from the JAR file i created
I want to know if theres any way i can use the class files of the project i created, to create new java files so that i can edit the code in netbeans ??
Please if anyone can shed some light on this topic, if its at all posible to gain access to the forms java content i created. Im new to programming and this is something above my knowledge (i hope this makes sense)
If not possible please let me know what an absolute idiot i am, so that i can start re creating the project from scratch ... Sigh, and thank you
A jar/class file is compiled bytecode that is not human-readable... but with Java it is easily converted back. Look into a program like JavaDecompiler.1 This is not my program but I use it and I find it workable for my needs.
1 If this is considered spam I'll gladly invalidate the link.
As a sidenote: You are lucky that its Java. In many other languages like C++ that would hardly be possible. The difference is that Java does not compile the source code to machine code. That step is hardly reversible since for example all variable names are lost. Try to understand a non-trivial piece of code without helpful variable names...
Java instead compiles the source code to byte code which then is interpreted by Java on runtime. That byte cold holds way more information about the original source code than machine code.
I've struggled a lot with Java but could not combine a working example of Java .wav to .mp3 converter. This converter will be used in a Java applet so it should depend only on libraries written in pure Java with no underlying C code calls.
Can anyone provide a fully working example?
Thank you
Read your wave file # http://java.sun.com/javase/technologies/desktop/media/jmf/
and encode to mp3 # http://openinnowhere.sourceforge.net/lameonj/
As pointed out, lameonj is not a pure java solution. For that the options don't seem so many, but see the other SO question: MP3 Encoding in Java
I use Jump3r to convert wav to mp3 on my project because the html5 player of IE11 can't play wav files.
Jump3r is the simpliest solution found to run inside a tomcat servlet. I wasn't able to integrate others solutions like jave certainly due to the security manager... Jump3r is a pure java program.
Jump3r is available on the maven repository (https://mvnrepository.com/artifact/de.sciss/jump3r/1.0.4) and the sources are available on github (https://github.com/Sciss/jump3r)
To convert a file, you should call the main method (in the following code, I use an inlined version of the main method to catch/throw an IOException if necessary)
private void convertWavFileToMp3File(File source, File target) throws IOException {
String[] mp3Args = { "--preset","standard",
"-q","0",
"-m","s",
source.getAbsolutePath(),
target.getAbsolutePath()
};
(new Main()).run(mp3Args);
}
If speed is not important for you, take any c implementation of MP3 (e. g. lame) and try to compile it with NestedVM to Java bytecode. It will be slow (like an emulator in an emulator), but it should work.
And it should be way less work than trying to port a MP3 library to pure Java.
See this link on SourceForge http://sourceforge.net/projects/jump3r/files/
Its JAR's only (no source code), but it does work on both PC and Android, but no necessarily as described in the authors posting http://pure-java-mp3-encoder.blogspot.com.au/
I got it to work by just using the jump3r-1.0.3.jar file, as a library, and instantiated
mp3.Main then used called mp3.run()
e.g. part of my Android code
String[] mp3Args = {"--preset","standard",
"-q","0",
"-m","s",
Environment.getExternalStorageDirectory().getPath()+"/myfile.wav",
Environment.getExternalStorageDirectory().getPath()+"/myfile.mp3"};
Main m = new mp3.Main();
try
{
m.run(mp3Args);
}
catch(Exception e)
{
System.out.println("ERROR processing MP3 " + e);// Some bug in Android seems to cause error BufferedOutputSteam is Closed. But it still seems to work OK.
}
I suspect it would be possible to directly call the lame encoder passing buffers of data etc, but as the exact API for this Java version is not documented, it would require some research
Another potentially relevant project is jffmpeg. This apparently aimed to an JMF support for a wide range of formats using both native and Java codecs. Judging from the 'formats' page, they made significant progress on the pure Java side. Unfortunately, the project has gone quiet.
This doesn't directly help the OP in the short term. But if he or others are keen to have pure Java codecs in the long term, consider getting involved.
Just check out the following source code.
http://jsidplay2.cvs.sourceforge.net/jsidplay2/jump3r
It is still work in progress, but a working example of the encoder part of a pure java based lame library.