Currently in one project I use GoogleMaps with ClusterMarker based on PhotSpot http://code.google.com/p/android-playground-erdao/wiki/PhotSpot.
I tried to convert it to use OpenStreetMap with mapsforge library( http://code.google.com/p/mapsforge/) replacing referenced libraries from googlemaps to mapsforge.
I need to override and implement method from mapsforge library in my custom class based on ClusterMarker ( http://code.google.com/p/android-playground-erdao/source/browse/trunk/SampleClusterMap/src/com/erdao/android/mapviewutil/markerclusterer/ClusterMarker.java ) from photspot and here I have hit the wall.
#Override
protected void drawOverlayBitmap(Canvas canvas, Point drawPosition, Projection projection,
byte drawZoomLevel) {
}
Did any of you tried to create clustermarker overlays on openstreetmap in java or maybe know any open source library that could help?
Thanks for great resource. Coincidentally, I was working on ItemClustering implementation for mapsforge too.
After importing SampleClusterMap source and making little adjustments to code I got it working. Here's a link to current project source http://ge.tt/7Zq63CH , most of changes are self explanatory. Don't forget to add mapsforge 0.3.0 library to build path.
Related
i have a question on how to add existing native android project to Nativescript/typescript project.
I have a source code for native android and try to use/call their java classses (eg: MainActivity.java) as an intent in my nativesript project.
I already read a documentation on [Extending the native application][1]
[1]: https://docs.nativescript.org/guides/integration-with-existing-ios-and-android-apps/extend-existing-android-app but its only explain how to add nativescript to existing android-app and not vice versa.
I try to google it but can't find a solution.
I need a guide on where to copy to source code and to which folder and how to call it as an intent. Do i need to change the AndroidManifest.xml and add the class as an activity (Activity tag) or application (Application tag).
If you have a link/documentation which i can refer to, hope you mind to share.
Your help is very much appreciated.
Sorry, i'm quite noob in nativescript.
Thanks in advance
You may convert your native project as an AAR library, copy that to your App_Resources/Android/lib then you should be able to access everything in it.
Here are docs that explains how you can access the native Java apis from JavaScript / TypeScript.
I am imported the zxing android library for use via gradle, however I want to modify the way things are drawn. From my understanding, that can only be changed by changing the draw function in one of the classes in the library. The problem is I cannot modify the classes in the library due to them being imported with gradle.
Is there any way I can edit that file or even supply another file to override that one? Thanks for your time.
Edit:
Here is a link to the zxing github and the class that I am trying to change the functions in. I want to be able to change what the onDraw function does.
https://github.com/zxing/zxing/blob/master/android/src/com/google/zxing/client/android/ViewfinderView.java
I wasn't able to find a way to override the file, but I did find a workaround. I ended up extending the zXingScannerView file and did an override for the function setAutoFocus(boolean state). I chose that one because it was always called after the overlay was set and allowed me to easily remove it straight away.
Inside that funtion I did:
int chidrenCount = getChildCount();
for(int i = 0; i < childrenCount; i++) {
if(getChildAt(i) instanceof ViewFinderView) {
getChildAt(i).setVisibility(View.INVISIBLE);
}
}
Thanks for the help #FlyingPumba
if you refer to the Zxing Android library for working with Barcodes, it's Open Source !
That means you can download the source code of this library, import it to your project and make the changes you need.
For reading more on importing libraries to Android projects, read this SO question.
Also, if you feel that other users of ZXing would benefit from this change, you can always contribute to the library on GitHub.
I'm handling an Android Project my company started last year.
I got a GreenDaoGenerator project with the infamous custom ExampleDaoGenerator.java. I'm pretty sure this is all well configured in order to work well and generate my entities.
I started developing the Android Project (which is in another folder/package, of course) but now I need to change the way Entities are instantiated in it.
I have a good amount of classes with the
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
on the top of them and I'd like to re-generate them since I commented out some rows in my custom ExampleDaoGenerator.
How can I do that? GreenDaoGenerator is not an Android Studio project, doesn't have any build.gradle file. It doesn't have any .class file either, just the java file and libraries to load for DaoGeneration. I didn't find anywhere in GreenDao documentation how to run the proper generation and harvest the created classes.
I tried of course javac the.full.path/src/whatever/ExampleDaoGenerator.java but it didn't work :-(
Do you happen to see what I'm doing wrong? I expected Android Studio Project to re-generate the database whenever the signatures are changed but it seems like it does not.
Thank you
You need to add a Java library module (File > New > New module..) to your Android project (assuming you're using Android Studio), and insert the generation code inside public static void main(String[] args) {} in this module's .java class. Then Run it and the code will be generated in you main app's module.
See how I did it in my blog post.
mmm.... manually? backup previous created classes (model), run the generator again and compare-update data?
I don't know if there are any new doc here, but allways is a good reading place. get project also available.
Good luck!
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.
:) :) 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)