android

How to show No Internet connection dialog in webview | Android Studio

落花浮王杯 提交于 2021-02-19 06:03:06
问题 I'm trying to add a message in a web view, the message should come out when you do not have an Internet connection. I have tried many ways but I always make a mistake that I do not understand. I create a folder called "assets" and add a file "error.html" following a YouTube tutorial but it gives me errors I will write my codes here without what I saw on YouTube. Thank you MainActivity.java import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support

GoogleJsonResponseException: 401 Unauthorized calling endpoint with OAuth2 protection

♀尐吖头ヾ 提交于 2021-02-19 06:01:07
问题 I am trying to make an Android app with App Engine as mobile backend. I am getting this error when I try to call an endpoint protected by authentication: 12-21 18:58:05.120 4452-4477/com.test.myapplication W/System.err﹕ com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unauthorized 12-21 18:58:05.120 4452-4477/com.test.myapplication W/System.err﹕ { 12-21 18:58:05.130 4452-4477/com.test.myapplication W/System.err﹕ { 12-21 18:58:05.130 4452-4477/com.test.myapplication W

RecyclerView ItemDecoration - How to draw a different width divider for every viewHolder?

拟墨画扇 提交于 2021-02-19 06:00:29
问题 Currently my divider is only drawing one width: How would can I add an extra divider for every increment position in my recyclerview? Here is my ItemDecoration class: public SimpleDivider(Context mContext, ArrayList<Integer> mDepth) { mDivider = ContextCompat.getDrawable(mContext, R.drawable.recycler_view_divider); this.mContext = mContext; this.mDepth = mDepth; dividerMargin = 15; } @Override public void onDraw(@NonNull Canvas c, @NonNull RecyclerView parent, @NonNull RecyclerView.State

Notification Timeout - Specifying delay between accessibility events

前提是你 提交于 2021-02-19 05:59:47
问题 I'd like to delay the accessibility events coming into my accessibility service so that the gap between accessibility events is 2 seconds. This is intended so that I do not process too many accessibility events and waste battery life. From reading the documentation, the proper way seems to be specifying the "android:notificationTimeout" attribute in my xml for my service. <accessibility-service android:accessibilityEventTypes="typeViewClicked|typeViewFocused" android:packageNames="com.example

accessing gpio from within kivy android app

落爺英雄遲暮 提交于 2021-02-19 05:58:26
问题 OK I am stumped and its possible I have just not had enough experience with android, so I dont know which permissions to use. I have recompiled the android kernel to expose the gpio pins I need, maybe I need to do something in the kernel to solve my problem... basically at this point i have no idea I can open adb shell and go /sys/class/gpio/export 141 and get the gpio folder and its files (value,direction,etc). and when I am in the adb shell I can set the direction and values using echo out

How to know multiple users configured in device?

邮差的信 提交于 2021-02-19 05:57:22
问题 Android 4.2 & above supports Multiple Users as described at below link... http://developer.android.com/about/versions/android-4.2.html#MultipleUsers Now, my questions are.. Is it possible to know multiple user configured in device programmatically ? If yes, then how to get number of user configured in device ? Is it possible to get list of users ? if yes then how ? 回答1: There is a public API to get user details but it is restricted to apps which have the "android.permission.MANAGE_USERS"

Using -std=c++11 on VS2015

孤人 提交于 2021-02-19 05:56:18
问题 I have created a shared object for Android in Visual Studio 2015 . It works fine so far, but pop_back() for a wstring does not work: wstring element = "JustATest!"; if (element.back() == L'!') { element.pop_back(); } VS2015 tells me: " no member named 'pop_back' in 'std::basic_string<wchar_t>' ". Can anybody tell me how to get rid of this error? I have no idea why this should not work. Is that because for some reason VS2015 does not use C++11 here? Thank you for the help! Edit: Another error:

「面试原题 + 图文详解 + 实例代码」二叉搜索树-双指针-贪心 面试题汇总

余生颓废 提交于 2021-02-19 05:51:36
本文将覆盖 「字符串处理」 + 「动态规划」 方面的面试算法题,文中我将给出: 面试中的题目 解题的思路 特定问题的技巧和注意事项 考察的知识点及其概念 详细的代码和解析 开始之前,我们先看下会有哪些重点案例: 为了方便大家跟进学习,我在 GitHub 建立了一个仓库 仓库地址: 超级干货!精心归纳 视频、归类、总结 ,各位路过的老铁支持一下!给个 Star ! <br> 现在就让我们开始吧! <br> 二叉搜索树 二叉搜索树(Binary Search Tree),它或者是一棵空树,或者是具有下列性质的二叉树: 若它的左子树不空,则左子树上所有结点的值均小于它的根结点的值; 若它的右子树不空,则右子树上所有结点的值均大于它的根结点的值; 它的左、右子树也分别为二叉搜索树。 <br> <br> 验证二叉搜索树 给定一个二叉树,判断其是否是一个有效的二叉搜索树。 假设一个二叉搜索树具有如下特征: 节点的左子树只包含小于当前节点的数。 节点的右子树只包含大于当前节点的数。 所有左子树和右子树自身必须也是二叉搜索树。 示例 : 输入: 5 / \ 1 4 / \ 3 6 输出: false 解释: 输入为: [5,1,4,null,null,3,6]。 根节点的值为 5 ,但是其右子节点值为 4 。 解题思路 乍一看,这是一道很简单的题。只需要遍历整棵树,检查 node.right

How to install an apk in one of the connected devices through adb? [closed]

限于喜欢 提交于 2021-02-19 05:43:46
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Improve this question I have multiple devices/emulators connected to my computer and I want to install an apk or run other adb commands in one of the devices. How do I do that? 回答1: If you want to install apk Multiple Emulator and one device attached you want to install apk on device :

How to change AppCompatCheckBox color efficiently?

与世无争的帅哥 提交于 2021-02-19 05:41:10
问题 I found a very strange behaviour in my AppCompatCheckBox, already searched a fix for it but didn't find, that's why I decided to ask here. I was trying to change the checked AppCompatCheckBox color programatically (as my app's color scheme changes dinamically, I can't use the XML attributes to color the CheckBox), so I used this approach: chkTos = (AppCompatCheckBox) findViewById(R.id.checkboxTos); ColorStateList colorStateList = new ColorStateList( new int[][]{ new int[]{-android.R.attr