Can't set options to LibVLC - java

I have been trying to utilize the Android SDK from Maffen:
https://github.com/mrmaffen/vlc-android-sdk/ in order to stream RTSP.
So I found the following stack overflow thread:
vlc-android-sdk - cannot view RTSP live video
Which has a number of answers of how to do this.
However, the problem I am having is that when I try to set the options for LibVLC it will not allow me to do so.
For example:
ArrayList<String> options = new ArrayList<String>();
options.add("--no-drop-late-frames");
options.add("--no-skip-frames");
options.add("--rtsp-tcp");
options.add("-vvv");
videoVlc = new LibVLC(options)
When I try to run this I get the following error message in Android Studio:
"error: incompatible types: ArrayList cannot be converted to Context"
Also if I hover over the "LibVLC(options)" section of the code it comes up with the following message:
"LibVLC (android.content.Context) in LibVLC cannot be applied to (java.util.ArrayList)
I'm no Java expert, so perhaps this is an easy fix but I have been trying different sample codes from around the internet all day and every single one sets those options and I can't do it.
Any help would be much appreciated. Thank you!
EDIT:
This problem was solved using the following:
videoVlc = new LibVLC(this, options);
I had simply forgot about including the context part of the LibVLC.
I forgot to go back and edit this once I had arrived at a solution.

maffen vlc android sdk. the constructor LibVLC takes two params. context and options. option can be null. and options should be the second one. the older version may only takes one param option

Related

IabHelper no longer imports android.vending.billing.IInAppBillingService after upgrading to billingclient:billing:2.1.0

On upgrading the billingclient to 2.1.0:
implementation 'com.android.billingclient:billing:2.1.0'//from 2.0.1
I suddenly got a cannot resolve symbol 'vending' error in my IabHelper class:
I've had to go back to billing:2.0.1 to prevent this. I notice the link to Trivial Drive 2 from the inapp billing docs https://github.com/android/play-billing-samples/tree/master/TrivialDrive_v2 now gives a '404' can't find error. Digging through githup I see Trivail Drive 2 is archived, a new Kotlin example is now featured, 'TrivialDriveKotlin'.
Is the Trivial Drive 2 implementation of inapp billing no longer supported by the latest billing code? Is there an java version of the TrivialDriveKotlin code somewhere?
I could and will do a translation if there isn't, but there should be a java version of this up front. Getting the original trivial drive 2 code working and debugged in the first place was such a pain.
My solution ended up being not to bother with the Trivial Drive example at all. The current implementation is simple enough to implement directly starting here https://developer.android.com/google/play/billing/billing_library_overview.
The tricky part right from the start is this line:
billingClient = BillingClient.newBuilder(activity).setListener(this).build();
It's odd to see both 'activity' and 'this' used in the same line as you would typically substitute 'this' for 'activity'. You will get compile or runtime errors if these aren't set correctly. Better would be:
billingClient = BillingClient.newBuilder(this).setListener(new PurchasesUpdatedListener() {...}).build();
or
PurchasesUpdatedListener puchaselistener;
puchaselistener = new PurchasesUpdatedListener() {...}
billingClient = BillingClient.newBuilder(this).setListener(purchaselistener).build();

Why this particular code generates "ambiguous method call" error in Android Studio?

I use iText 5 in Android Studio to create a PDF document but I get an error:
I also tried
p.add((Phrase)c);
but I get same error :-(
How I can get rid of this error?
"ambiguous" error comes up when u already have a file/varibale etc with same name.
for example when you make a project using entity framework , entity framework make class and dbcontext files for u. but if u add a class with same name as entity framework had made for u then this error comes up. check ur project/programe correctly and fully again...
Hope its helpfull !!
and checkout this link for ur answer Android Studio - Ambiguous method call getClass()
thanks for reply - indeed I needed help regarding why 'ambiguous' appears in this context.
But now the problem is solved - this error does not appear anymore - but I don't know exactly why.
I did some Android Studio updates last week may this helped?
Thanks anyway!
In case when we use data binding, some java files are auto-generated
The problem was occured when a getter/setter has the same name with a function.
eg
var newData
fun getNewData()
in this case, in the generated java file, the variable's getter has the same name with the function => getNewData.
So simply you have to change variable name or fuction name

Java exception error during RJDBC::dbConnect: how to silently ignore?

I am trying to connect to a SAS-driven remote database from within R, using RJDBC. The first time I do a dbConnect, I get an error:
Error in .jcall(drv#jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1],
: java.lang.NoClassDefFoundError: com/sas/net/crypto/CryptoException
When I do the dbConnect a second time after the first call, it connects fine, and I get back an object of class JDBCConnection.
I looked in the sas.core.jar file (from the latest 94M2 SAS JDBC drivers), and can see CryptoException listed in there. However, I am also curious why it was trying to throw a CryptoException.
Question 1: How can I silently ignore the error on the first dbConnect call?
Question 2: Why was it trying to throw a CryptoException? What can I do to prevent this? (This may cancel question 1.)
This is the same question as shared on the SAS Support Communities page:
https://communities.sas.com/thread/80620
There you shared the code you are using
https://github.com/wthielen/wrds/blob/7edfbfe89ddc329618be72e591cc0bd50e294ea4/R/wrds.R#L47
In this code, the problem appears to be that you are trying to set the classpath before initializing the JVM. Using .jinit() before the call to .jaddClassPath should correct the issue. In the doc for .jinit and since you are developing a package, you may want to use .jpackage instead of .jinit
https://www.rforge.net/doc/packages/rJava/jpackage.html
I was having the same problems and tried the above solutions with no change.
The solution on my computer was modifying the .Renviron file which holds the classpath to the java drivers. Replacing "JDBC_Drivers" with "WRDS_Drivers" was all that was needed:
CLASSPATH="C:/Users/nicol/Documents/WRDS_Drivers/sas.core.jar;C:/Users/nicol/Documents/WRDS_Drivers/sas.intrnet.javatools.jar"

Open Filesystem Raster Dataset in ArcGIS using ArcObjects 10.2 in Java

SOLVED: see my answer below
I am trying to open .tif, .img, and .dat Raster files to a new layer in ArcMap.
I have tried all the methods I have found in the documentation and a few implementations on StackOverflow.
This is the current code:
File file = new File(output);
IWorkspaceFactory wsFactory = (IWorkspaceFactory)new RasterWorkspaceFactory();
IRasterWorkspace2 rasterWS = (IRasterWorkspace2)wsFactory.openFromFile(file.getParentFile().getAbsolutePath(),0);
IRasterDataset rds = rasterWS.openRasterDataset(output);
IRasterLayer rasterLayer = new RasterLayer();
rasterLayer.createFromDataset(rds);
IActiveView activeView = mxDocument.getActiveView();
IMap _map = activeView.getFocusMap();
_map.addLayer(rasterLayer);
This code throws no error messages, but it does not open the layer. Previous implementations that I took from sample programs and documentation for arcObjects 10.2 throw exceptions on this line:
RasterDataset rasterDataset = (RasterDataset) rasterWorkspace.openRasterDataset(file.getAbsolutePath());
The only lead I have right now is the ControlsAddDataCommand class to possibly call the command for opening the files and give the filepath as input. Build a custom command to open the file?
Note: The files open fine by clicking the addData option on the Layer menu.
SOLVED
IRasterLayer rasterLayer = new RasterLayer();
rasterLayer.createFromFilePath(output);
mxDocument.addLayer(rasterLayer);
Found this code by browsing the JavaDoc Tooltips in Eclipse.
Just type in the object and a "." Eclipse will show all the options available.
I'm amazed this code snippet wasn't listed anywhere online (that I found in about 8 hours of searching). Anyways, that's the simple 3 line solution!

Enabling PDF417 Decoding in Zxing

I am trying to get PDF417 barcode reading to be enabled in ZXing (Zebra Crossing). I did a pull from the github repo and built the library according to the wiki. The ant build output seems to indicate that the PDF417 submodule is being built. I tried to test everything according to the wiki using these images but I get a "no barcode found" error.
kscottz#kscottz-laptop:~/barcode/zxing$ java -cp javase/javase.jar:core/core.jar com.google.zxing.client.j2se.CommandLineRunner Sample_PDF417.png
file:/home/kscottz/barcode/zxing/Sample_PDF417.png: No barcode found
kscottz#kscottz-laptop:~/barcode/zxing$ java -cp javase/javase.jar:core/core.jar com.google.zxing.client.j2se.CommandLineRunner bc.png
file:/home/kscottz/barcode/zxing/bc.png: No barcode found
kscottz#kscottz-laptop:~/barcode/zxing$ java -cp javase/javase.jar:core/core.jar com.google.zxing.client.j2se.CommandLineRunner sanitycheck.jpg
file:/home/kscottz/barcode/zxing/sanitycheck.jpg (format: QR_CODE, type: TEXT):
Raw result:
<-- SNIP -->
What gives? Am I missing a flag to enable PDF417? Where would one look to set these sorts of configuration options? I am regularly a Python/C/C++ developer so I may be missing something pretty basic.
Try --try_harder, otherwise it's in the mode suitable for mobile devices, instead of using more CPU to scan the image more. --pure_barcode will probably work too since these are synthetic images.
In general. These don't seem to decode though. I can't access the first image, and the second isn't found even in the online decoder (which you can always use as a check): http://zxing.elasticbeanstalk.com/w/decode.jspx
I don't know why since I presume it's valid. You can run through the debugger to see exactly what goes wrong.
So I ran the ZXing test script on the test barcodes and they do pass, so I am going to assume it is enabled. It appears that when zxing says alpha they really mean alpha. =(
Basically to detect only PDF417 barcode using ZXING library, you need to pass in the hints asking ZXING to only look for PDF417 type.
try below,
hints.put(DecodeHintType.POSSIBLE_FORMATS, EnumSet.of(BarcodeFormat.PDF_417));
Checkout the below example,
LuminanceSource source = new BufferedImageLuminanceSource(bufferedImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Map<DecodeHintType, Object> hints = new EnumMap<>(DecodeHintType.class);
hints.put(DecodeHintType.POSSIBLE_FORMATS, EnumSet.of(BarcodeFormat.PDF_417));
//hints.put(DecodeHintType.POSSIBLE_FORMATS, EnumSet.allOf(BarcodeFormat.class));
hints.put(DecodeHintType.CHARACTER_SET, "utf-8");
hints.put(DecodeHintType.TRY_HARDER, true);
Result result = new MultiFormatReader().decode(bitmap, hints);

Categories

Resources