小编raf*_*asq的帖子

FileProvider错误

https://developer.android.com/training/camera/photobasics.html

我所要做的就是用相机拍照,保存并在ImageView中显示.

我按照上面的android教程继续在行上得到一个错误(一个NullPointerException):

Uri photoURI = FileProvider.getUriForFile(this, "com.example.android.fileprovider", photoFile);
Run Code Online (Sandbox Code Playgroud)

我知道我需要在应用程序的清单中配置FileProvider,并且"权限"必须匹配.我不太明白我应该在当局的论点中提出什么.我复制了教程中的所有代码,包括文件res/xml/file_paths.xml.如有必要,请提出任何问题

谢谢!

android android-appwidget android-studio android-fileprovider

13
推荐指数
1
解决办法
2万
查看次数

TextColor与TextColorPrimary对比TextColorSecondary

在整个应用程序中,每个文本都包含哪些内容?

更具体地说,在我的应用程序中,主题中的每一个都会发生什么变化?我希望我的按钮文本与我的文本视图颜色不同; 是一个主要的,另一个是次要的?

任何与这些条款相关的信息表示赞赏!

java android themes textcolor

12
推荐指数
1
解决办法
1万
查看次数

NotImplementedError:分组地图 Pandas UDF 的返回类型无效

我的 Pandas UDF 的 output_schema 包含以下字段:

Out[183]: [StructField(id,StringType,true),
 StructField(2018-01-01,StructType(List(StructField(real,FloatType,true),StructField(imag,FloatType,true))),true),
 StructField(2018-01-02,StructType(List(StructField(real,FloatType,true),StructField(imag,FloatType,true))),true),
 StructField(2018-01-03,StructType(List(StructField(real,FloatType,true),StructField(imag,FloatType,true))),true),
 StructField(2018-01-04,StructType(List(StructField(real,FloatType,true),StructField(imag,FloatType,true))),true),
 StructField(2018-01-05,StructType(List(StructField(real,FloatType,true),StructField(imag,FloatType,true))),true),
 StructField(2018-01-06,StructType(List(StructField(real,FloatType,true),StructField(imag,FloatType,true))),true),
 StructField(2018-01-07,StructType(List(StructField(real,FloatType,true),StructField(imag,FloatType,true))),true),
 StructField(2018-01-08,StructType(List(StructField(real,FloatType,true),StructField(imag,FloatType,true))),true),
 ...
Run Code Online (Sandbox Code Playgroud)

并且类型为: Out[185]: pyspark.sql.types.StructType

我想要输出的是一列,而id其余列是包含两个浮点数的元组。我用于定义架构的代码如下,基本上StructType()为不是id.

fields = []
for f in json.loads(skeleton_schema.json())["fields"]:
  if f["name"] != "id":
    fields.append(StructField(f["name"], StructType([ 
          StructField(FloatType(), True),
          StructField(FloatType(), True)
        ]), True))
  else:
      fields.append(StructField.fromJson(f))
output_schema = StructType(fields)
Run Code Online (Sandbox Code Playgroud)

但是,当运行我的 UDF 时,我收到一个NotImplementedError,输出打印我的整个架构并表示不支持它。到底什么不受支持,我做错了什么?

python pandas apache-spark pyspark

6
推荐指数
1
解决办法
2228
查看次数

列出 VM 及其集群

我想连接到多个 VIserver 并列出所有 VM + 它们各自的集群。这可能吗?

我已经到了Get-VM | Select Name,VMHost。代替 VMHost 的哪些属性会列出集群?

powershell powercli vsphere

5
推荐指数
1
解决办法
9597
查看次数

setImageBitmap 不显示

单击后,我的应用程序会在相机和图库之间进行选择,然后该图片将显示在 ImageView 中。我最初尝试显示完整图像,然后尝试使用位图方式,但没有任何效果。我只是得到一个空白的 ImageView。请给我一些关于我做错了什么的指导,并在必要时要求澄清:

相机/图库照片代码:

Uri outputFileUri;
private void openImageIntent() {
    // Determine Uri of camera image to save.
    final File root = new File(Environment.getExternalStorageDirectory() + File.separator + "MyDir" + File.separator);
    root.mkdirs();
    final String fname = "img_" + System.currentTimeMillis() + ".jpg";
    final File sdImageMainDirectory = new File(root, fname);
    outputFileUri = Uri.fromFile(sdImageMainDirectory);
    // Camera.
    final List<Intent> cameraIntents = new ArrayList<Intent>();
    final Intent captureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    final PackageManager packageManager = getPackageManager();
    final List<ResolveInfo> listCam = packageManager.queryIntentActivities(captureIntent, 0);
    for(ResolveInfo res : listCam) …
Run Code Online (Sandbox Code Playgroud)

android imageview android-layout

4
推荐指数
1
解决办法
9688
查看次数

权限拒绝:MediaDocumentsProvider

尝试显示 URI 时出现以下异常。我认为它发生在我的活动停止并且我再次尝试访问可行的 URI 之后。还有其他问题可以解决这个问题,但我很困惑如何将任何解决方案应用于我的代码,因为我的 takePhotoIntent 允许拍摄或从图库中选择图片(见下文)。

Unable to open content: content://com.android.providers.media.documents/document/image%3A49688
java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaDocumentsProvider uri 
content://com.android.providers.media.documents/document/image%3A49688 from pid=821, uid=10238 requires android.permission.MANAGE_DOCUMENTS, or grantUriPermission()
Run Code Online (Sandbox Code Playgroud)

我的 createImageFile 和我的 takePhotoIntent:

private File createImageFile() throws IOException {
    // Create an image file name
    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
    String imageFileName = "JPEG_" + timeStamp;
    File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
    File image = File.createTempFile(
            imageFileName,  /* prefix */
            ".jpg",         /* suffix */
            storageDir      /* directory */
    );

    // Save a file: path …
Run Code Online (Sandbox Code Playgroud)

java android android-permissions

1
推荐指数
1
解决办法
4111
查看次数

知道何时以及如何旋转对象

下面的CSV为我x,z提供了id = 1在给定时间内t以秒为单位的汽车坐标.

我能够在每一秒更新汽车游戏对象的变换位置就好了.问题在于,当汽车的方向发生变化时,我需要能够旋转(或逼真地转动)汽车,使其指向正常的方向.我现在尝试使用简单的Lerp旋转(然后使用标准资产CarController脚本使之后更加逼真).

我现在面临的当前问题是知道汽车何时转弯,以及如何确定汽车的转向,以及转向哪种方向.我怎么能这样做?

t,id,x,z
908,1,0.00,755.17
909,1,-1.50,732.50
910,1,-1.50,715.84
911,1,-1.50,699.17
912,1,-1.50,682.50
913,1,-1.50,679.19
914,1,-1.50,679.19
915,1,-1.50,679.19
916,1,-1.50,653.52
917,1,-1.50,636.85
918,1,-1.50,620.19
919,1,-1.50,603.52
920,1,-1.50,586.85
921,1,-1.50,570.19
922,1,-1.50,553.52
923,1,-1.50,536.85
924,1,-1.50,521.94
925,1,-1.50,521.94
926,1,-1.50,521.94
927,1,-1.50,521.94
928,1,-1.50,521.94
929,1,-1.50,521.94
930,1,-1.50,521.94
931,1,-1.50,496.28
932,1,-1.50,479.61
933,1,-1.50,462.94
934,1,-1.50,446.28
935,1,-1.50,429.61
936,1,-1.50,412.94
937,1,-1.50,396.28
938,1,-1.50,379.61
939,1,-1.50,378.74
940,1,-1.50,378.74
941,1,-1.50,378.74
942,1,-1.50,378.74
943,1,-1.50,378.74
944,1,-1.50,378.74
945,1,-1.50,378.74
946,1,-1.50,350.07
947,1,-1.50,333.40
948,1,-1.50,316.74
949,1,-1.50,300.07
950,1,-1.50,283.40
951,1,-1.50,266.74
952,1,-1.50,250.07
953,1,-1.50,233.40
954,1,-1.50,232.39
955,1,-1.50,232.39
956,1,-1.50,232.39
957,1,-1.50,232.39
958,1,-1.50,232.39
959,1,-4.50,209.72
960,1,-4.50,193.05
961,1,-4.50,176.39
962,1,-4.50,159.72
963,1,-4.50,143.05
964,1,-4.50,126.39
965,1,-4.50,109.72
966,1,-4.50,93.05
967,1,-4.50,76.39
968,1,-4.50,59.72
969,1,-4.50,43.05
970,1,-4.50,26.39
971,1,-4.50,9.72
972,1,-4.50,6.00
973,1,-4.50,6.00 …
Run Code Online (Sandbox Code Playgroud)

c# simulation unity-game-engine

0
推荐指数
1
解决办法
190
查看次数

团结:在给定目标点和方向的情况下逼真地转动汽车

我有一个CSV,它给我x,z一个汽车的坐标,id在给定的时间内t以秒为单位.下面是一辆汽车的摘录数据id=1,它的坐标是几秒钟.在前三秒钟,汽车停了下来.然后它向左转并继续直行几秒钟.

目前我正在根据下一个位置计算方向并将车辆朝向该方向旋转,但转弯处没有"曲线",它只是直接移动到下一个位置:

Vector3 direction = (nextPosition - car.transform.position).normalized;
if(direction != Vector3.zero)
{
    Quaternion lookRotation = Quaternion.LookRotation(direction);
    float step = speed * Time.deltaTime;
    car.transform.rotation = Quaternion.Slerp(car.transform.rotation, lookRotation, Time.deltaTime * rotationSpeed);
}
Run Code Online (Sandbox Code Playgroud)

鉴于刚刚这些点,特别是两个在958959在转弯时,有没有办法更真实地使转弯?我知道Unity的标准资产CarController.cs具有转向功能,但我不确定我是否可以利用它来获得优势.

t,id,x,z
956,1,-1.50,232.39
957,1,-1.50,232.39
958,1,-1.50,232.39
959,1,-4.50,209.72
960,1,-4.50,193.05
961,1,-4.50,176.39
Run Code Online (Sandbox Code Playgroud)

c# simulation unity-game-engine

0
推荐指数
1
解决办法
485
查看次数