New to Android. Trying to understand how to get the list of available apertures. The code below does not work as expected. Could someone please explain how I can extract the list from this property? Using camera 2 api.
apertures = CameraCharacteristics.LENS_INFO_AVAILABLE_APERTURES;
You have to use getCameraCharacteristics("camerayouwant").get() to get the characters.
float[] aperatures = CameraManager.getCameraCharacteristics("camerayouwant").get(CameraCharacteristics.LENS_INFO_AVAILABLE_APERTURES);
Use aperatures = CameraManager.getCameraCharacteristics("camerayouwant").get(CameraCharacteristics.LENS_INFO_AVAILABLE_APERTURES);
Related
I'm building an app which reads EXIF data from images and overlays that data on the image so you can share your camera settings with a nice graphic rather than manually typing them out (EG: "F/1.4 at 1/200 ISO400")
I'm using AndroidX ExifInterface 1.1.0-beta01 and the blow code works to get every piece of data except the LensMake and LensModel are always null.
I've tried reverting to ExifInterface 1.0.0 and that made no difference, it still behaves identically.
I note that the documentation for ExifInterface refers to LensMake and LensModel as returning an "ASCII String" which Camera Make and Camera Model just return a "String" so i've tried different variations of getAttribute without success.
These exact files work fine on the iOS version of the app I've previously built and i've tried files from multiple different cameras (Fuji X-T3, Canon 5D III)
var stream: InputStream? = null
try {
stream = contentResolver.openInputStream(uri)
val exifInterface = ExifInterface(stream!!)
FS = exifInterface.getAttribute(ExifInterface.TAG_F_NUMBER)!!
SS = exifInterface.getAttribute(ExifInterface.TAG_EXPOSURE_TIME)!!
ISO = exifInterface.getAttribute(ExifInterface.TAG_PHOTOGRAPHIC_SENSITIVITY)!!
val LensMake = exifInterface.getAttribute(ExifInterface.TAG_LENS_MAKE) //THIS APPEARS TO BE ALWAYS NULL :(
val LensModel = exifInterface.getAttribute(ExifInterface.TAG_LENS_MODEL) //THIS APPEARS TO BE ALWAYS NULL :(
val CameraMake = exifInterface.getAttribute(ExifInterface.TAG_MAKE)
val CameraModel = exifInterface.getAttribute(ExifInterface.TAG_MODEL)
}
I'd like to be able to read the lens information, I know it's in the file but this library doesn't seem to want to expose it.
There is an open bug filed on the issue tracker, which states, that:
Although the constants are available for LensMake and LensModel, the getter does not return the actual values from the file. It seems like proper support is missing. I think the reason is that ExifTag[] IFD_EXIF_TAGS does not contain an array item for lens make and model. Adding the following lines at the right place of the aforementioned array, seems to fix things:
new ExifTag(TAG_LENS_MAKE, 42035, IFD_FORMAT_STRING),
new ExifTag(TAG_LENS_MODEL, 42036, IFD_FORMAT_STRING),
Not sure how reliable this is, but it is at least a solution approach.
How do i show the standard PositionIndicator from the HereWeGo-App in my MapActivity?
This one:
When i use this Code:
mPositioningManager = PositioningManager.getInstance()
mPositioningManager.addListener(
newWeakReference<PositioningManager.OnPositionChangedListener>(MyActivity.this));
if (mPositioningManager.start(PositioningManager.LocationMethod.GPS_NETWORK_INDOOR))
{
mapFragment.getPositionIndicator().setVisible(true);
}
i get this Indicator:
Is there some other way to create the "HereWeGo-Indicator"? As i know if you implement the Indicator iOS you get by default the "HereWeGo-Indicator".
If you want to use image than do like below
Image img_current_location = new Image();
img_current_location.setImageResource(R.drawable.custom_img);
after that set on PositionIndicator.
Map.getPositionIndicator().setMarker(img_current_location);
And if you dont want to use image at all than create compass header. sample example can downloaded from the below link.
https://tcs.ext.here.com/sdk_examples/CustomPositionMarker.zip
some discussion can be found on this post.
It does not fit in your requirement but you can modify it.
I follow the following link's sample code
http://android.dronekit.io/first_app.html
and when I set API VehicleApi.getApi(this.drone).arm(true);
vehicleState.isFlying() automatically becomes true.
Can anybody tell me what this problem is?
What I need is:
1. take off, land
I read from some website that the dronekit-android does not support the mode changing. If so, how should I send the mavlink message to take off and land?
So far, I can sucessfully send the mavlink message to the PX4 board.
Thanks for replying.
Thank you for replying.
BR
SeanH
If you trace though some of the code in dronekit-android, you can see that isFlying is set here with the code below.
boolean isFlying = systemStatus == MAV_STATE.MAV_STATE_ACTIVE || ...;
MAV_STATE_ACTIVE, defined here states
System is active and might be already airborne. Motors are engaged.
So isFlying doesn't mean it's airborne but just that the motors are turned on. That occurs when you call VehicleApi.getApi(this.drone).arm(true); because you are literally arming the vehicle at that point.
For takeoff, you want to use the ControlApi. ControlApi.getApi(drone).takeOff(desired_altitude, listener) and for land you need to use VehicleApi.getApi(drone).setVehicleMode(VehicleMode.COPTER_LAND, listener)
The sample code you're looking at is very old. I suggest you follow the sample app from github.
I have not tried android-dronekit before and I noticed that the src folder have not been updated for more than two years on github.
I advice you to use python-dronekit because there is a powerful library called pymavlink in python and used in python-dronekit. You can build hyper application if you want but first try to takeoff and land in python.
thanks for checking my question out!
I'm currently working on a project using Qt C++, which is designed to be multi-platform. I'm a bit of a newcoming to it, so I've been asked to set up the ability to take screenshots from within the menu structure, and I'm having issues with the Android version of the companion app.
As a quick overview, it's a bit of software that send the content of a host PC's screen to our app, and I've been able to take screenshots on the Windows version just fine, using QScreen and QPixmap, like so:
overlaywindow.cpp
{
QPixmap screenSnapData = screenGrab->currentBackground();
}
screenGrabber.cpp
{
QScreen *screen = QGuiApplication::primaryScreen();
return screen->grabWindow( QApplication::desktop()->winId() );
}
Unfortunately, Android seems to reject QScreen, and with most suggestions from past Google searches suggesting the now-deprecated QPixmap::grab(), I've gotten a little stuck.
What luck I have had is within the code for the menu itself, and QWidget, but that isn't without issue, of course!
QFile doubleCheckFile("/storage/emulated/0/Pictures/Testing/checking.png");
doubleCheckFile.open(QIODevice::ReadWrite);
QPixmap checkingPixmap = QWidget::grab();
checkingPixmap.save(&doubleCheckFile);
doubleCheckFile.close();
This code does take a screenshot, but only of the button strip currently implemented, and not for the whole screen. I've also taken a 'screenshot' of just a white box with the screen's dimensions by using:
QDesktopWidget dw;
QWidget *screen=dw.screen();
QPixmap checkingPixmap = screen->grab();
Would anyone know of whether there was an alternative to using QScreen to take a screenshot in Android, or whether there's a specific way to get it working as compared to Windows? Or would QWidget be the right track? Any help's greatly appreciated!
as i can read in Qt doc : In your screenGrabber.cpp :
QScreen *screen = QGuiApplication::primaryScreen();
return screen->grabWindow( QApplication::desktop()->winId() );
replace with :
QScreen *screen = QGuiApplication::primaryScreen();
return screen->grabWindow( 0 ); // as 0 is the id of main screen
If you want to take a screenshot of your own widget, you can use the method QWidget::render (Qt Doc):
QPixmap pixmap(widget->size());
widget->render(&pixmap);
If you want to take a screenshot of another app/widget than your app, you should use the Android API...
I'm novice at Xamarin and I'm trying to use ShinobiCharts in Xamarin.Android to show candlestick data on it.
Code from .axml:
<fragment
class="com.shinobicontrols.charts.ChartFragment"
android:id="#+id/chart"
android:layout_width="match_parent"
android:layout_height="match_parent" />
This is fragment where should be shown chart.
var chartFragment = (ChartFragment)FragmentManager.FindFragmentById(Resource.Id.chart);
var chart = chartFragment.ShinobiChart;
chart.SetLicenseKey("license_key");
chart.AddXAxis(new DateTimeAxis
{
GesturePanningEnabled = true,
GestureZoomingEnabled = true
});
chart.AddYAxis(new NumberAxis
{
GesturePanningEnabled = true,
GestureZoomingEnabled = true
});
var dataPoints =
quotes.Select(
quoteCandle =>
new MultiValueDataPoint(DateUtils.ConvertToJavaDate(TimeStamp.UnixToDate(quoteCandle.Timestamp)),
(double) quoteCandle.Low, (double) quoteCandle.High,
(double) quoteCandle.Open, (double) quoteCandle.Close)).ToList();
var series = new OHLCSeries { DataAdapter = new SimpleDataAdapter() };
series.DataAdapter.AddAll(dataPoints);
chart.AddSeries(series);
chart.XAxis.Style.GridlineStyle.GridlinesShown = true;
chart.YAxis.Style.GridlineStyle.GridlinesShown = true;
chart.RedrawChart();
This is code of creating ShinobiCharts.
The problem is that added series are not shown in chart. Style changed, but there are no series. What do I do wrong? I hope anyone can help.
Sorry for question, Candlestickes are not available for trial version of ShinobiControls, only for premium version.
As sammyd said, CandlestickSeries are available in the trial version of ShinobiCharts for Android (as are all the other premium features). Have you managed to get the CandlestickChart sample running? The sample is included in the download bundle.
On the face of it your code looks fine (without seeing the rest of it) but there are a couple of things I'd recommend checking:
Have you replaced the string license_key with the trial license key we would have emailed you when you downloaded the bundle? The trial license key is a a really long string of characters and digits.
Is your data coming in as expected and does it make sense (e.g. are your low values less than your open values etc.)?
I'm not sure it'll make much difference, as they're pretty much interchangeable, but you're actually creating an OHLCSeries in code but mention a CandlestickSeries
Have you set the series' style object in a way that would stop it from showing i.e. have you set it to be transparent in colour?
Are you getting an actual error, and if so what message is being logged?
Hopefully the above will help you get your candlestick chart up and running!
Edit:
If you're using the Android Emulator, your AVD needs to have GPU emulation turned on (as we use OpenGL ES 2.0 for rendering the charts). There's more information on using the emulator with OpenGL on the Android developer site.
Disclaimer: I work for ShinobiControls