android

Android Facebook 4.0 Logout Programmatically

旧巷老猫 提交于 2021-02-19 03:08:39
问题 In my app, I allow users to login to and logout from Facebook programmatically. For login, I call: ArrayList<String> permissions = new ArrayList(); permissions.add("manage_pages"); permissions.add("publish_actions"); LoginManager.getInstance().logInWithPublishPermissions(App.activity, permissions); And for logout, I call: FacebookSdk.sdkInitialize(getApplicationContext()); LoginManager.getInstance().logOut(); When I call the logInWithPublishPermissions() method above, the official Facebook

Android Facebook 4.0 Logout Programmatically

家住魔仙堡 提交于 2021-02-19 03:08:04
问题 In my app, I allow users to login to and logout from Facebook programmatically. For login, I call: ArrayList<String> permissions = new ArrayList(); permissions.add("manage_pages"); permissions.add("publish_actions"); LoginManager.getInstance().logInWithPublishPermissions(App.activity, permissions); And for logout, I call: FacebookSdk.sdkInitialize(getApplicationContext()); LoginManager.getInstance().logOut(); When I call the logInWithPublishPermissions() method above, the official Facebook

Navigation Component: how to navigate from activity to a fragment

做~自己de王妃 提交于 2021-02-19 03:02:32
问题 I want to navigate on click FAB in (activity) to New fragment 1. in my code fab button in the main activity common for all pages. could anyone guide me? activity.xml <?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools

https遇到自签名证书/信任证书

好久不见. 提交于 2021-02-19 02:50:10
对于CA机构颁发的证书Okhttp默认支持 可以直接访问 但是对于 自定义 的证书就不可以了(如:https : //kyfw.12306.cn/otn/ ), 需要加入Trust 下面分两部分来写,一是信任所有证书,二是信任指定证书,访问自签名的网站 一、信任所有证书 1. 在你的module 下 build.gradule里添加 dependencies { 、、、 compile 'com.zhy:okhttputils:2.6.2' 、、、} 2.新建MyApplication public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); // 这就是信任所有证书 HttpsUtils.SSLParams sslParams = HttpsUtils.getSslSocketFactory(null,null, null); OkHttpClient okHttpClient = new OkHttpClient.Builder() .connectTimeout(10000L, TimeUnit.MILLISECONDS) .readTimeout(10000L, TimeUnit.MILLISECONDS)

How to set legend labels MPChart

被刻印的时光 ゝ 提交于 2021-02-19 02:46:25
问题 I am trying to customize legend but not able to do so.My purpose is to give different legend labels.I ma using MPChart library to do so. ArrayList<BarEntry> entries = new ArrayList<>(); entries.add(new BarEntry(4f, 0)); entries.add(new BarEntry(8f, 1)); entries.add(new BarEntry(6f, 2)); entries.add(new BarEntry(12f, 3)); entries.add(new BarEntry(18f, 4)); mColors.add(R.color.red); mColors.add(R.color.text_color_gray); mColors.add(R.color.text_color_blue); mColors.add(R.color.green); mColors

How to handle SAF when I can only handle File or file-path?

落花浮王杯 提交于 2021-02-19 02:43:06
问题 Background Up until Android Q, if we wanted to get information about an APK file, we could use WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE to get access to the storage, and then use PackageManager.getPackageArchiveInfo function on the file-path. Similar cases exist, such as using ZipFile class on a compressed file, and probably countless framework APIs and third party libraries. The problem Google announced a huge amount of restrictions recently on Android Q. One of them is called Scoped

How to properly approach threading with Room

泄露秘密 提交于 2021-02-19 02:39:59
问题 I am confused about Room and can not find an answer in the documentation. So, the library enforces using queries on a separate Thread, which is understandable. However, it seems that Delete queries are not included in this limitation and can be freely called from the UI Thread. They also always return a raw output value, without a chance to wrap it in an Observable. What is the correct way to use the delete call in Room then ? Should it be run on a separate Thread? If not, what about

Redirect all network of Android App (which is using Libraries) through a proxy network (if available)

偶尔善良 提交于 2021-02-19 02:35:08
问题 I am working on an Android application and I am using various libraries like Picaso, Retrofit, Crashlytics, etc. and my college WIFI have proxy on it. I know how to use a proxy when sending a HTTP requests to a server, but all the libraries that I am using have there own HTTP requests, so overriding all their HTTP classes would be a headache, and I am not even sure how to do that. So, is there a way to route all the traffic of the App through a proxy (when available), like any library or some

Android 8 native crash at native library

若如初见. 提交于 2021-02-19 02:34:26
问题 Since the rollout of Android 8 Oreo, our app has been consistently crashing in different places. All the play store crash reports show native crashes. The most frequently occuring one seems to be at native library. The most frequent device that crashes is the Google Pixel and Pixel XL have also shown a few. I ll post the crash log below. I m struggling to find what causes the crash. Any help is appreciated. *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** Build fingerprint:

setting opencv video to fullscreen android

空扰寡人 提交于 2021-02-19 02:33:10
问题 i am trying to set a video to fullscreen using opencv. the input is coming from the camera. it shows on the screen in the center but not as full screen. relevant code: public class Sample3Native extends Activity implements CvCameraViewListener { private static final String TAG = "OCVSample::Activity"; private Mat mRgba; private Mat mGrayMat; private Mat mFinalMat; private CameraBridgeViewBase mOpenCvCameraView; private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {