小编use*_*714的帖子

git submodule update --remote vs git pull

跑步有什么区别

git submodule update --remote
Run Code Online (Sandbox Code Playgroud)

VS

cd <submodule directoy>
git pull
Run Code Online (Sandbox Code Playgroud)

假设子模块先前已设置为跟踪某个分支:

git submodule add -b master [URL to Git repo]
Run Code Online (Sandbox Code Playgroud)

git git-submodules

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

Firebase keepSynced(true)

当我在Firebase数据库中的多个路径上使用同步时,有什么权衡取舍?

databaseRef.keepSynced(true);
Run Code Online (Sandbox Code Playgroud)

我从不清除这些路径的同步.

另外,我可能会调用databaseRef.keepSynced(true); 在同一条路上多次.是ta问题?

我也在用

FirebaseDatabase.getInstance().setPersistenceEnabled(true);
Run Code Online (Sandbox Code Playgroud)

那么,就电池续航时间,内存问题而言,我为此同步"付费"了什么?

android firebase firebase-realtime-database

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

android camera2示例应用程序android-Camera2Basic在第一次捕获后抛出异常

我正在使用谷歌示例应用程序camera2basic(https://github.com/googlesamples/android-Camera2Basic),但它在执行第一次图片捕获后抛出异常.我看到相机已关闭,但如何正确修理?我希望谷歌样本能够显示正确的生命周期.这是一个例外:

07-06 10:26:00.296    8066-8110/com.example.android.camera2basic I/RequestQueue? Repeating capture request set.
07-06 10:26:00.571    8066-8111/com.example.android.camera2basic V/RenderScript? 0x9e643200 Launching thread(s), CPUs 8
07-06 10:26:19.656    8066-8078/com.example.android.camera2basic W/CameraBase? mediaserver's remote binder Camera object died
07-06 10:26:19.661    8066-8083/com.example.android.camera2basic W/CameraBase? Camera service died!
07-06 10:26:19.661    8066-8144/com.example.android.camera2basic E/Camera? Error 100
07-06 10:26:19.661    8066-8144/com.example.android.camera2basic E/RequestThread-0? Received error 100 from the Camera1 ErrorCallback
07-06 10:26:19.661    8066-8144/com.example.android.camera2basic I/CameraDeviceState? Legacy camera service transitioning to state ERROR
07-06 10:26:22.671    8066-8166/com.example.android.camera2basic E/RequestThread-0? Hit timeout for jpeg callback!
07-06 10:26:22.671    8066-8166/com.example.android.camera2basic W/RequestHolder? Capture failed …
Run Code Online (Sandbox Code Playgroud)

android android-camera

8
推荐指数
0
解决办法
1918
查看次数

登录到Android上的谷歌驱动器,而无需将谷歌帐户添加到设备

我开发了一个Android应用程序,需要允许对用户的谷歌驱动器进行读/写访问.此外,它应该在公共设备上运行(意味着许多人可能使用相同的设备访问他们的谷歌驱动器帐户).在这种情况下,将每个用户的帐户添加到Android帐户管理器是不可接受的.不幸的是,所有官方指南都使用在设备上注册的Google帐户进行身份验证.将显示从设备中选择现有Google帐户或添加新帐户的弹出窗口.

protected void onStart() {
        super.onStart();
        if (mGoogleApiClient == null) {
            mGoogleApiClient = new GoogleApiClient.Builder(this)
                    .addApi(Drive.API)
                    .addScope(Drive.SCOPE_FILE)
                            // Optionally, add additional APIs and scopes if required.
                    .addConnectionCallbacks(this)
                    .addOnConnectionFailedListener(this)
                    .build();
        }
        mGoogleApiClient.connect();
    }



    /**
     * Called when {@code mGoogleApiClient} is trying to connect but failed.
     * Handle {@code result.getResolution()} if there is a resolution
     * available.
     */
    @Override
    public void onConnectionFailed(ConnectionResult result) {
        Log.i(TAG, "GoogleApiClient connection failed: " + result.toString());
        if (!result.hasResolution()) {
            // Show a localized error dialog.
            GooglePlayServicesUtil.getErrorDialog(
                    result.getErrorCode(), …
Run Code Online (Sandbox Code Playgroud)

android google-drive-api google-play-services google-drive-android-api

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

android camera2处理每一帧并显示其预览

我使用https://github.com/googlesamples/android-Camera2Basic,但尝试修改它,以便在Surfaceview上绘制之前我可以访问每个帧.我明白了,我应该添加额外的表面(ImageReader.getSurface()),并在此回调中从中读取帧:

private final ImageReader.OnImageAvailableListener mOnImageAvailableListener
            = new ImageReader.OnImageAvailableListener() {

        @Override
        public void onImageAvailable(ImageReader reader) {

           Log.d("Img", "onImageAvailable");
            mBackgroundHandler.post(new ImageSaver(reader.acquireNextImage(), mFile));
        }

    };
Run Code Online (Sandbox Code Playgroud)

问题是只有当用户捕获图像而不是从摄像机发送到预览屏幕的eacg帧时,才会调用此回调.

这是我试图添加的内容:

private void createCameraPreviewSession() {
        try {
            SurfaceTexture texture = mTextureView.getSurfaceTexture();
            assert texture != null;

            // We configure the size of default buffer to be the size of camera preview we want.
            texture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());

            // This is the output Surface we need to start preview.
            Surface surface = new Surface(texture);

            // We set up a …
Run Code Online (Sandbox Code Playgroud)

android image-processing surfaceview android-camera

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

Android WebView onPageCommitVisible未触发

我有一个WebView,它从服务器加载html页面,但是该页面在WebView上不可见。html已正确加载(我已使用chrome:// inspect调试,并且html,包括所有存在的javascript都存在),但在电话屏幕上不可见。出现此错误时,我的代码没有任何更改。当我在手机上安装Android System WebView更新时,出现了该错误。如果我卸载更新,则所有更新都将再次正常运行。此外,我检查了WebViewClient的回调,并注意到未调用onPageCommitVisible。因此,该页面无法正确加载。仅当我按下“后退”按钮以退出WebView时,我才会看到为我的网页调用了onPageCommitVisible(但这样做没有帮助,因为后退按钮确实存在WebView)。

这是我的webview代码:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    RelativeLayout rlMain = new RelativeLayout(getActivity());
    rlMain.setContentDescription(Constants.STARTAPP_AD_MAIN_LAYOUT_CONTENT_DESCRIPTION);
    rlMain.setId(Constants.MAIN_LAYOUT_ID);
    getActivity().setContentView(rlMain);

    // Create WebView and set its parameters
    try{
        webView = new WebView(getActivity().getApplicationContext());
        webView.setBackgroundColor(0xFF000000);
        getActivity().getWindow().getDecorView().findViewById(android.R.id.content).setBackgroundColor(0x00777777);
        webView.setVerticalScrollBarEnabled(false);
        webView.setHorizontalScrollBarEnabled(false);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.setWebChromeClient(new WebChromeClient());
        // set software acceleration
        if (softwareAcceleration) {
            ApiUtil.setWebViewLayerTypeSoftware(webView, null);

        } 

        webView.setOnLongClickListener(new OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                return true;
            }
        });
        webView.setLongClickable(false);

        webView.addJavascriptInterface(createJsInterface(), Constants.INTERFACE);

        setWebViewSpecificParameters(webView);  


        webView.loadDataWithBaseURL("http://www.xxxxxx.com", getHtml(), "text/html", "utf-8", null);


        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            WebView.setWebContentsDebuggingEnabled(true);
        }
        webView.setWebViewClient(new MyWebViewClient());

        RelativeLayout.LayoutParams …
Run Code Online (Sandbox Code Playgroud)

android webview android-webview

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

在Recyclerview的onBindViewHolder里面安装Android Firebase监听器

我有一个Android聊天应用程序,它可以在本地SQLite DB和Firebase实时数据库中存储所有消息.

在RecyclerView中显示消息时,我从本地数据库中查询它们(因为本地存储了一些未存储在实时数据库中的附加数据).

我需要实时更新显示的消息发送和读取状态,这是我从实时数据库中获得的.

为recycleler视图的onBindViewHolder中的每条消息设置一个值事件监听器是否可以?

这样我只会监听当前显示在屏幕上的消息中的更改,而不会从服务器获取整个消息列表.(正是我需要的)

2个问题: - 这个解决方案是好还是有更好的方法? - 我需要删除回收器视图中不可见的项目的侦听器.我怎么做?

我没有使用FirebaseUI(我知道它解决了我的问题),但我想从本地数据库而不是从服务器提供数据,只从firebase实时数据库获取一个字段的更新.

firebase android-recyclerview firebase-realtime-database firebaseui

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