When Im trying to remove an annotation, I’m receiving an error:
java.lang.NullPointerException: Attempt to invoke interface method
‘void
com.scichart.charting.visuals.annotations.IAnnotationPlacementStrategy.drawAdorner(android.graphics.Canvas)’
on a null object reference at
com.scichart.charting.visuals.annotations.AnnotationBase.onDrawAdorner(SourceFile:889)
at
com.scichart.charting.visuals.annotations.AdornerLayer.onDraw(SourceFile:144)
at android.view.View.draw(View.java:17071) at
android.view.View.updateDisplayListIfDirty(View.java:16053)
I’ve tried many ways, like:
UpdateSuspender.using(priceChart, new Runnable() {
#Override
public void run() {
priceChart.getAnnotations().clear();
}
});
and
UpdateSuspender.using(priceChart, new Runnable() {
#Override
public void run() {
priceChart.getAnnotations().remove(myAnnotation);
}
});
But I just can't remove it.
That's weird. There's a SciChart Android Tutorial on Annotations here. It uses 'chart.getAnnotations().remove(0)'
The full source code for this tutorial can be found at the SciChart.Android.Examples Github repository.
Does it work for you?
this is the official answer from Scichart team:
Hi Marcos,
I want to notify you that I’ve investigated and fixed this issue. It
was caused by a small bug in our code – when you remove annotation
from chart it doesn’t remove adorner for annotation if it is selected.
The fix will be available in our next nightly build and for now you
can workaround this issue by unselecting annotation before removing
from collection:
UpdateSuspender.using(priceChart, new Runnable() {
#Override
public void run() {
myAnnotation.setSelected(false);
priceChart.getAnnotations().remove(myAnnotation);
}
});
Hope this will help you!
Best regards,
Yura
Related
I am using Google CoreAR package in my React-Native app for AR support. There are some devices which support AR and some not. I am getting error while I run the application in non-supported devices. I want to render a message instead showing error on the screen. For this Google CoreAR package is providing the solution which is not working for me.
void maybeEnableArButton() {
ArCoreApk.Availability availability = ArCoreApk.getInstance().checkAvailability(this);
if (availability.isTransient()) {
// Continue to query availability at 5Hz while compatibility is checked in the background.
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
maybeEnableArButton();
}
}, 200);
}
if (availability.isSupported()) {
mArButton.setVisibility(View.VISIBLE);
mArButton.setEnabled(true);
} else { // The device is unsupported or unknown.
mArButton.setVisibility(View.INVISIBLE);
mArButton.setEnabled(false);
}
}
The problem with above code snippet is that availability.isSupported() is always returning true and that's why else part of code is not running. Can you guys please help me with this?
Thank you.
I found solution for this problem. ArCoreApk.Availability has some methods which can be used. You can find these methods in the
documentation. The method ArCoreApk.Availability
return either SUPPORTED_INSTALLED or SUPPORTED_NOT_INSTALLED depending on device support. So based on this return value we can do the stuff.
I did like this.
#ReactMethod
public ArCoreApk.Availability getSupport(){
ArCoreApk.Availability availability = ArCoreApk.getInstance().checkAvailability(this.getReactApplicationContext());
return availability.name();
}
I have two classes TrapCard and EquipmentCard, from which I want to make an object and pass this object through activities. I put a string and a int variable into my parcelable object. The int variable is a reference to an .svg image. And then I'm trying to get the reference from the object to load the .svg image in another activity. For TrapCard this works. But when I'm doing the excat same thing for EquiptmentCard my app crashes with E/Zygote: isWhitelistProcess - Process is Whitelisted
Constructor from EquiptmentCard:
public EquipmentCard(String cardName){
this.cardName = cardName;
switch (cardName){
case "Rope": cardPicRes = R.drawable.ic_rope;
break;
}
}
And here I'm trying to get the reference and load the image
final EquipmentCard equipCard = new EquipmentCard(cardName);
returnIntent.putExtra("card",equipCard);
returnIntent.putExtra("cardType","E");
runOnUiThread(new Runnable() {
#Override
public void run() {
imgViewCard.setImageDrawable(getResources().getDrawable(equipCard.getCardPicRes(), getApplicationContext().getTheme()));
}
});
Here same thing for TrapCard, this works
final TrapCard trapCard = new TrapCard(cardName);
returnIntent.putExtra("card",trapCard);
returnIntent.putExtra("cardType","F");
runOnUiThread(new Runnable() {
#Override
public void run() {
imgViewCard.setImageDrawable(getResources().getDrawable(trapCard.getCardPicRes(), getApplicationContext().getTheme()));
}
});
I'm doing this within the receiveDetections function from the Google mobileVisionAPI
with debugging I can see that my code runs to this line
imgViewCard.setImageDrawable(getResources().getDrawable(equipCard.getCardPicRes(), getApplicationContext().getTheme()));
and then crashes with the mentioned error in logcat.
I put this in try and catch but there is no error I receive. Thank you in advance for your time and have a nice day.
UPDATE1: I set the image in EquipmentCard to ic_spider1 and it worked. I have no clue whats wrong with ic_rope.
UPDATE2: Now i get an exception android.content.res.Resources$NotFoundException: Drawable xxx.xxx:drawable/ic_rope with resource ID #0x7f060072 but i have no clue why. I added this the same way i added spider. Delete and adding again don't work.
UPDATE3: Alright. It seems that my ic_rope.xml has a large string inside. I tried to rebuild my Project and then it shows the message string too large to encode using UTF-8. If i delete the ic_rope.xml i can rebuild without any errors.
Try replacing
imgViewCard.setImageDrawable(getResources().getDrawable(equipCard.getCardPicRes(), getApplicationContext().getTheme()));
with:
setImageResource(R.id.your_image_id)
We are using crashlyticsDidDetectCrashDuringPreviousExecution to detect java crashes and report them to our BI systems, but our app is mostly C++ and we are using crashlytics NDK, we can't find anything similar to crashlyticsDidDetectCrashDuringPreviousExecution.
Is there any way that we can actually detect an NDK crash when the app starts?
thanks
Oded
Mike from Fabric here.
Currently, there isn't a way to do this within Fabric or the SDK for an NDK crash.
NOTE: This works on older version only (Crashlytics 2.6.7 and CrashlyticsNDK 1.1.6)
I'm also looking for a solution for this.
We currently found a partial solution. I'm not sure how good it is, it's definitely not official, plus it's asynchronic (which we're trying to overcome by looping), but it's the best solution I found and it seems like it's working
Fabric.with(this, new Crashlytics.Builder().core(core.build()).build(), new CrashlyticsNdk(), new Crashlytics());
if (!userLeft) { // our handling to fix bug, see explanation below
new Thread(new Runnable() {
#Override
public void run() {
SessionEventData crashEventData = null;
for (int i = 0; i < 10; i++) {
try {
Thread.sleep(1000); // in ms
} catch (InterruptedException e) { }
crashEventData = CrashlyticsNdk.getInstance().getCrashEventData();
if (crashEventData != null)
{
// there was a crash!
// crash timestamp can be found at crashEventData.timestamp
break;
}
}
}
}).start();
}
Explaination for userLeft:
We had some bug with reporting crash for users that exited app, and this is the solution for that. We set this flag to true, and save it on the device (SharedPreferences). We do it on our main activity (which extends NativeActivity), on finish() func.
Code:
#Override
public void finish() {
// set some key such as USER_LEFT to TRUE
super.finish();
}
After that, just get that USER_LEFT value, assign it into userLeft param, and set it back to false on SharedPerferences.
Any insights about this solution?
I want to show progress of my file upload. I use built.io to store my files, but really don't know how I can show progress, because I think built.io does not support this.
This is how I send file:
final BuiltFile builtFileObject = new BuiltFile();
builtFileObject.setFile(tempFile.getPath());
builtFileObject.save(new BuiltResultCallBack() {
#Override
public void onSuccess() {
}
#Override
public void onError(BuiltError builtError) {
Toast.makeText(getContext(),"blad zapisu pliku",Toast.LENGTH_SHORT).show();
}
#Override
public void onAlways() {
}
});
This is not possible using the current SDK provided by built.io. There is a plan to support this in the future.
A workaround is to call built.io using the REST APIs (check out the REST section on https://docs.built.io/guide#uploads). The regular HTTP upload call can then be tracked to get the progress detail.
Please mail us at support#built.io if you have any more queries with this! Glad to help.
v1.addView(new TransfomedViewWidget(<-- (9)
this,
new Transformation() {<-- (10)
#Override public String describe() { return "rotate(-30)"; }
#Override public void transform(Canvas canvas) {
canvas.rotate(-30.0F);
} }));
I am new to Java and android programming , can anyone tell me what this <-- operator means? I am getting error while trying to compile this in eclipse.
It isn't part of the syntax, it loks like something else has put it there.
Certainly it was a note or comment ... add // in front of them and try to compile again.