我正在尝试在java中创建一个管理不同社交共享应用程序的类.该类基于android意图.
但是当我尝试执行Telegram intent时,它找不到应用程序.
在这里,我把我写的代码:
public void shareTelegram(String message)
{
Intent waIntent = new Intent(Intent.ACTION_SEND);
waIntent.setType("text/plain");
waIntent.setPackage("com.telegram");
if (waIntent != null) {
waIntent.putExtra(Intent.EXTRA_TEXT, message);//
_androidActivity.startActivity(Intent.createChooser(waIntent, "Share with"));
}
else
{
Toast.makeText(_androidActivity.getApplicationContext(), "Telegram is not installed", Toast.LENGTH_SHORT).show();
}
}
Run Code Online (Sandbox Code Playgroud)
我在哪里可以找到包裹名称?提前致谢.
我正在尝试为Android相机API 2开发虚幻引擎4插件.
正如我可以在虚幻引擎论坛上看到的那样,有两种可能为Android制作插件.
第一,包括修改UE Android基础项目(GameActivity).
第二个是独立的插件,它带来了在任何项目中添加插件的可移植性.
根据这篇文章,有可能制作一个相机Api1独立插件,它使用APL.xml文件添加java代码.
但我认为它非常局限于游戏活动,如下面的代码.
<?xml version="1.0" encoding="utf-8"?>
<!--ARToolKit plugin additions-->
<root xmlns:android="http://schemas.android.com/apk/res/android">
<!-- init section is always evaluated once per architecture -->
<init>
<log text="AndroidCamera init"/>
</init>
<androidManifestUpdates>
<addPermission android:name="android.permission.CAMERA"/>
<addFeature android:name="android.hardware.camera"/>
<addFeature android:name="android.hardware.camera.autofocus"/>
</androidManifestUpdates>
<!-- optional additions to the GameActivity imports in GameActivity.java -->
<gameActivityImportAdditions>
<insert>
import android.widget.Toast;
import android.hardware.Camera;
import android.hardware.Camera.CameraInfo;
import android.hardware.Camera.Parameters;
import android.hardware.Camera.PreviewCallback;
import android.graphics.SurfaceTexture;
import android.graphics.ImageFormat;
import android.graphics.PixelFormat;
import java.util.List;
import java.io.IOException;
import android.util.Log;
</insert>
</gameActivityImportAdditions>
<gameActivityClassAdditions>
<insert>
static …Run Code Online (Sandbox Code Playgroud) 我正在开发自定义相机API 2应用程序,我注意到当我使用ImageReader回调时,某些设备上的捕获格式转换是不同的.
例如在Nexus 4中工作不正常并且在Nexus5X中看起来没问题,这是输出.
我以这种形式初始化ImageReader:
mImageReader = ImageReader.newInstance(320, 240, ImageFormat.YUV_420_888,2);
Run Code Online (Sandbox Code Playgroud)
而我的回调是简单的回调ImageReader回调.
mOnImageAvailableListener = new ImageReader.OnImageAvailableListener() {
@Override
public void onImageAvailable( ImageReader reader) {
try {
mBackgroundHandler.post(
new ImageController(reader.acquireNextImage())
);
}
catch(Exception e)
{
//exception
}
}
Run Code Online (Sandbox Code Playgroud)
};
在Nexus 4的情况下:我有这个错误.
D/qdgralloc: gralloc_lock_ycbcr: Invalid format passed: 0x32315659
Run Code Online (Sandbox Code Playgroud)
当我尝试在两个设备中编写原始文件时,我有这些不同的图像.所以我知道Nexus 5X图像具有NV21编码,而Nexus 4具有YV12编码.

我找到了图像格式的规范,我尝试在ImageReader中获取格式.有YV12和NV21选项,但显然,当我尝试获取格式时,我得到YUV_420_888格式.
int test=mImageReader.getImageFormat();
Run Code Online (Sandbox Code Playgroud)
那么有没有办法让相机输入格式(NV21或YV12)区分相机类中的这种编码类型?CameraCharacteristics可能吗?
提前致谢.
垂发.PD:我使用OpenGL显示RGB图像,我使用Opencv进行转换为YUV_420_888.
我正在尝试将android pictureCallback解码为灰度垫:
首先我尝试使用rawPicture回调但总是得到空指针.
mCamera.takePicture(null, mPicture, null);
Run Code Online (Sandbox Code Playgroud)
JpegCalback给我不是null byte []数组,但cvtColor转换不起作用.
mCamera.takePicture(null, null, mPicture);
Run Code Online (Sandbox Code Playgroud)
我的预览回调就是这个
Camera.PictureCallback mPicture = new Camera.PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
Toast.makeText(getApplicationContext(),"picture taken",Toast.LENGTH_SHORT);
int res=JniManager.setImage(data,m_width,m_height);
mCamera.stopPreview();
mCamera.startPreview();
}
};
Run Code Online (Sandbox Code Playgroud)
c ++ JNI函数:
Java_pidaas_vicomtech_org_facerec_viulib_JniManager_setImage(JNIEnv *env,
jobject instance,
jbyteArray image,
jint width,
jint height)
jbyte* _yuv = env->GetByteArrayElements(image, 0);
int len = env->GetArrayLength (image);
unsigned char* buf = new unsigned char[len];
env->GetByteArrayRegion (image, 0, len, reinterpret_cast<jbyte*>(buf));
Mat rawData (cv::Size(width,height), CV_8UC3, buf );
cv::Mat test =imdecode(rawData,CV_LOAD_IMAGE_COLOR);
cv::Mat …Run Code Online (Sandbox Code Playgroud) 我试图在Android Studio中执行CMake脚本作为具有OpenCV依赖关系的externalNativeBuildTool。
我知道我可以在脚本中静态定义OpenCV,而我不想使用OpenCV管理器或android studio插件。我希望jus传递Opencv_dir参数,以避免将所有标头和库复制到项目中。
因此,总而言之,我有这个错误:
Could not find a package configuration file provided by "OpenCV" with any of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Run Code Online (Sandbox Code Playgroud)
我一直在寻找类似的解决方案:
https://developer.android.com/ndk/guides/cmake.html#build-command。
但是这些参数不令人满意,并且我试图将Opencv_dir像这样放置:
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -fno-rtti -fexceptions "
arguments "-DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=18
-DOpenCV_DIR="+getOpenCVDir().toString()
}
}
def getOpenCVDir() {
Properties properties = new Properties()
properties.load(new File(rootDir.absolutePath + "/local.properties").newDataInputStream())
def externalModuleDir = properties.getProperty('opencv.dir', null)
if (externalModuleDir == null) {
throw new GradleException(
"OpenCV location not found. Define location with opencv.dir in the local.properties file!")
} …Run Code Online (Sandbox Code Playgroud)