小编use*_*117的帖子

与元素类型“item”关联的属性“name”的值不得包含“<”字符

java.io.IOException: 无法从 android/accounts/annotations.xml 解析 XML

任何人都可以帮助解决上述错误?

android

5
推荐指数
2
解决办法
2927
查看次数

从 WebView 检测并获取播放视频 url

WebView在应用程序中使用加载网址。我想要的功能是检测视频并获取 url(如果网络视图中正在播放任何视频)。

我已经使用WebViewClient过并且shouldOverrideUrlLoading(WebView view, String url)

网页视图代码

    webview = findViewById(R.id.webview);
    WebSettings webSettings = webview.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webview.getSettings().setPluginState(WebSettings.PluginState.ON);
    webview.getSettings().setBuiltInZoomControls(true);
    webview.getSettings().setDisplayZoomControls(true);
    webview.getSettings().setDomStorageEnabled(true);
    webview.getSettings().setUseWideViewPort(true);
    webview.getSettings().setLoadWithOverviewMode(true);
    webview.setWebViewClient(new MyWebViewClient());
    webview.loadUrl("https://www.google.com/");
Run Code Online (Sandbox Code Playgroud)

WebView客户端代码

  private class MyWebViewClient extends WebViewClient {

    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        super.onPageStarted(view, url, favicon);
    }

    @Override
    public void onPageFinished(WebView view, String url) {
        super.onPageFinished(view, url);
    }

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        if (url.contains("youtube") && !url.contains("-youtube")) {
            Toast.makeText(context, "This is youtube url", Toast.LENGTH_SHORT).show(); …
Run Code Online (Sandbox Code Playgroud)

android android-webview

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

我如何设置文本的位置?

我有一个问题,我想从特定的位置设置文本的位置.例如:我在我的textview中有这个文本:"abcd efgh ijkl mnop qrstu vwxyz"现在我希望这个文本从位置"efgh"而不是"abcd"显示我如何在textview中执行此操作.我想改变文本的位置而不是textview的位置.谢谢

android textview

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

从图库或 Google 相册中选择图片失败

编辑:我想更新问题的真正所在。在三星手机上,您有“图库”,在“图库”中,您还可以看到您的谷歌照片备份。这是我想要的照片选择。现在在其他应用程序 (Close5) 上,它们只是显示一条消息,指出 “不支持该照片”。但为什么?为什么我们不能让这个 url (https://lh3.googleusercontent) 工作?

E/BitmapFactory:无法解码流:java.io.FileNotFoundException:/https:/lh3.googleusercontent.com/-Llgk8Mqk-rI/U8LK0SMnpWI/AAAAAAAAFk4/0cktb59DnL8GgblJ-IJIUBDuP9MQXCBPACHM/I/120jpg50:/IJIUBDuP9MQXCBPACHM21/IMG50:/这样的文件或目录)

你们都可以清楚地看到这是一张带有真实网址的真实照片:

https:/lh3.googleusercontent.com/-Llgk8Mqk-rI/U8LK0SMnpWI/AAAAAAAAFk4/0cktb59DnL8GgblJ-IJIUBDuP9MQXCBPACHM/I/IMG_20140711_085012.jpg
Run Code Online (Sandbox Code Playgroud)

一切正常,直到我从照片或谷歌照片图像而不是从图库中选择,我尝试处理异常 ( Sorry, that image isn't supported. Try another gallery!) 但这似乎不完整。我尝试在这里查看其他解决方案,但没有一个适用于谷歌照片。谢谢!

错误是一个空指针:

应用程序 E/BitmapFactory:无法解码流:java.io.FileNotFoundException:/https:/lh3.googleusercontent

 @Override
    public void onActivityResult(int requestCode, int resultCode,
                                    Intent data) {
        if (resultCode != Activity.RESULT_CANCELED) {
                if (requestCode == 1) {
                    try{
                    String selectedImagePath = getAbsolutePath(data.getData());                          ((PostAdParentTabHost)getActivity()).getMap_of_picture_paths().put(1, selectedImagePath);                      
                    post_ad_camera_img_1.setImageBitmap(decodeSampledBitmapFromFileToCustomSize(selectedImagePath, 150, 150));
                    animation_master.fade(post_ad_camera_img_1);
                    }catch(Exception e){
                        e.printStackTrace();
                        ((PostAdParentTabHost)getActivity()).getMap_of_picture_paths().remove(requestCode);
                        Toast.makeText(getActivity(), "Sorry, that image isn't supported. Try another gallery! ", Toast.LENGTH_SHORT).show();
                    }

//------------------------------------------------------Methods:
public String getAbsolutePath(Uri uri) { …
Run Code Online (Sandbox Code Playgroud)

java android android-gallery google-photos

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

Camera2 API 和 java.lang.IllegalStateException

我正在创建一个支持已弃用和新相机 API 的应用程序。第一个很有魅力,但我正在努力使用 Camera2 API。在测试阶段,我注意到了奇怪的行为。测试设备是带有 android 6.0.1 的三星 Galaxy S5 当我按下电源/结束键然后返回应用程序时,这就是我得到的(不是每次都发生):

03-12 16:14:32.704 24117-24117/pl.tripper.tripper E/MainActivity: onPause
03-12 16:14:32.774 24117-24128/pl.tripper.tripper E/BufferQueueProducer: [SurfaceTexture-1-24117-2] dequeueBuffer: BufferQueue has been abandoned
03-12 16:14:32.784 24117-24145/pl.tripper.tripper E/BufferQueueProducer: [SurfaceTexture-1-24117-2] queueBuffer: BufferQueue has been abandoned
03-12 16:14:33.044 24117-24128/pl.tripper.tripper E/BufferQueueProducer: [SurfaceTexture-1-24117-2] cancelBuffer: BufferQueue has been abandoned
03-12 16:14:33.044 24117-24145/pl.tripper.tripper E/BufferQueueProducer: [SurfaceTexture-1-24117-2] cancelBuffer: BufferQueue has been abandoned
03-12 16:14:33.054 24117-24129/pl.tripper.tripper E/BufferQueueProducer: [SurfaceTexture-1-24117-2] cancelBuffer: BufferQueue has been abandoned
03-12 16:14:33.054 24117-24128/pl.tripper.tripper E/BufferQueueProducer: [SurfaceTexture-1-24117-2] cancelBuffer: BufferQueue has been abandoned
03-12 16:14:33.264 24117-24117/pl.tripper.tripper E/CameraNewApi: …
Run Code Online (Sandbox Code Playgroud)

android surfaceview android-camera android-camera2

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

Android ExifInterface不保存属性

下面是我的代码-

try {
  InputStream inputStream = getAssets().open("thumbnail.jpg");
  exifInterface = new ExifInterface(inputStream);
  exifInterface.setAttribute(ExifInterface.TAG_ARTIST,"TEST INPUT");
  exifInterface.saveAttributes();
} catch (IOException e) {
  e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)

我在线上exifInterface.saveAttributes()收到以下错误 -

java.io.IOException:ExifInterface 不支持保存当前输入的属性。

我不确定错误是由于图像文件还是由于属性引起的。我正在努力挽救。我还在网上寻找可能的解决方案(例如 Sanselan),但不确定它是否能解决这个问题。

有人可以解释如何解决这个问题吗?

谢谢!

android android-exifinterface

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

Room Android - 如何处理数据库版本升级

我正在阅读关于Android架构组件的房间,并想知道Room中是否存在与SQLiteOpenHelper中可用的onUpgrade方法等效的内容 -

@Override public void onUpgrade(最终的SQLiteDatabase数据库,final int oldVersion,final int newVersion){}

谢谢,RS.

android android-room android-architecture-components

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

当我使用 FCM 从 Ruby on Rails 后端发送推送通知时,Android 应用程序正在关闭

我正在尝试使用 FCM gem 向 Android 手机发送推送通知消息。我能够获得设备令牌,并且我认为我按照它应该的方式设置了所有内容。只有当我使用我的 ruby​​ 后端发送测试消息时,我才会得到以下响应:

{:body=>"{\"multicast_id\":7171621681139926581,\"success\":1,\"failure\":0,\"canonical_ids\":0,\"results\":[{\"message_id\":\"0:1556626239337337%e087ffcde087ffcd\"}]}", :headers=>{"content-type"=>["application/json; charset=UTF-8"], "date"=>["Tue, 30 Apr 2019 12:10:39 GMT"], "expires"=>["Tue, 30 Apr 2019 12:10:39 GMT"], "cache-control"=>["private, max-age=0"], "x-content-type-options"=>["nosniff"], "x-frame-options"=>["SAMEORIGIN"], "x-xss-protection"=>["1; mode=block"], "server"=>["GSE"], "alt-svc"=>["quic=\":443\"; ma=2592000; v=\"46,44,43,39\""], "accept-ranges"=>["none"], "vary"=>["Accept-Encoding"], "connection"=>["close"]}, :status_code=>200, :response=>"success", :canonical_ids=>[], :not_registered_ids=>[]}
Run Code Online (Sandbox Code Playgroud)

但是在电话上我没有收到通知。

我的 ruby​​ 后端如下所示:

fcm_client = FCM.new(server_key)

    # options = {:notification => "Test notification",:data => {:message => "This is a FCM Topic Message!"}}
    options = { "notification": {
        "title": "Portugal vs. Denmark",
        "body": "5 to 1"
        }
    }

    user_device_ids.each_slice(20) do …
Run Code Online (Sandbox Code Playgroud)

ruby java android ruby-on-rails firebase-cloud-messaging

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

警告(15,5)Kotlin:从不使用参数“args”

//This is simple Hello world example in Kotlin (using intellij IDEA)
class Main {
    fun main (args: Array<String>){
        println("sss")
    }
}
Run Code Online (Sandbox Code Playgroud)

我希望打印 msg ,而不是收到警告

警告:(5, 15) Kotlin:从未使用过参数“args”

program-entry-point kotlin

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

在 Heroku 上为仅侦听 https 的服务使用哪个环境变量

我正在使用将部署在 Heroku 上的 AspNet 核心设置一个仅限 https 的 Web API 服务。部署是通过 docker 完成的,所以我配置了一个 Dockerfile。但是,每当我部署到 Heroku 时,都会收到与 https 端口绑定相关的错误。我想知道 Heroku 是否为 https 提供了一个特殊的 env 变量,服务可以在其中绑定以指定服务应该侦听的 https 端口。

AspNet 核心提供 2 个环境变量ASPNETCORE_HTTPS_PORT=5001ASPNETCORE_URLS=https://*:5001其中可以指定服务应侦听的 https 端口。

但是由于 Heroku 不允许 Web 进程手动指定它应该侦听的端口,因此它们提供了一个 Web 应用程序可以绑定到的 PORT 环境变量。

我试过使用ASPNETCORE_HTTPS_PORT=$PORTand ASPNETCORE_URLS=https://*:$PORT,但出现以下错误:

crit: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to start Kestrel.
System.Net.Sockets.SocketException (13): Permission denied at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName) 
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportFactory.BindAsync(EndPoint endpoint, CancellationToken cancellationToken)
at …
Run Code Online (Sandbox Code Playgroud)

c# heroku asp.net-core

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