小编Lak*_*Lak的帖子

Google+登录 - 自定义登录按钮后,handleSignInResult返回false

我正在按照Google提供的示例代码将Google plus与android集成. https://github.com/googlesamples/google-services/blob/master/android/signin/app/src/main/java/com/google/samples/quickstart/signin/SignInActivity.java

该代码示例完全正常,直到我添加了一些更改,如下所示.

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
 .requestScopes(new Scope(Scopes.PLUS_LOGIN))
 .requestEmail()
 .build();

mGoogleApiClient = new GoogleApiClient.Builder(this)
 .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
 .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
 .build();

signinGoogleBtn = (SignInButton) findViewById(R.id.signingoogleBtn);
signinGoogleBtn.setSize(SignInButton.SIZE_STANDARD);
signinGoogleBtn.setScopes(gso.getScopeArray());
Run Code Online (Sandbox Code Playgroud)

我将Google+范围添加到GoogleSignInOptions以自定义登录按钮.然后GoogleSignInResult和handleSignInResult总是返回false.

if (requestCode == RC_SIGN_IN) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        handleSignInResult(result);
Run Code Online (Sandbox Code Playgroud)

有人可以帮我解决这个问题吗?

android google-authentication google-plus-signin

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

闪烁 imageView 几秒钟

在我的 Android 应用程序中,我有一个闪屏,它会闪烁应用程序的徽标 3 秒钟,然后启动登录活动。这是我的代码:

imgView.postDelayed(new Runnable() {
        @Override
        public void run() {
            final Animation animation = new AlphaAnimation(1, 0);
            animation.setDuration(1000);
            animation.setInterpolator(new LinearInterpolator());
            animation.setRepeatCount(Animation.INFINITE);
            animation.setRepeatMode(Animation.REVERSE);
            imgView.startAnimation(animation);
        }
    }, 3000);
Intent intent = new Intent(SplashscreenActivity.this,LoginActivity.class);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

但图像无限闪烁。如何让3秒后停止眨眼?我参考了一些帖子,但无法得到确切的答案。

animation android duration splash-screen imageview

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

警告:mysqli_connect():MySQL服务器已经消失

我写了一个简单的PHP代码连接到mysql服务器,如下所示

    <?php

$username = "root";
$password = "Kepwd";
$hostname = "localhost:81";

//connection to the database
$dbhandle = mysqli_connect($hostname, $username, $password)
  or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";

 ?>
Run Code Online (Sandbox Code Playgroud)

但这会产生以下错误.我在google和stactoverflow中找到了一些关于此问题的主题.但那些对我没有帮助.请有人帮帮我吗?

    ( ! ) Warning: mysqli_connect(): MySQL server has gone away in C:\wamp\www\SSDConsultingNew\inc\test.php on line 8
Call Stack
#   Time    Memory  Function    Location
1   0.0014  240936  {main}( )   ..\test.php:0
2   0.0014  241528  mysqli_connect ( )  ..\test.php:8

( ! ) Warning: mysqli_connect(): Error while reading greeting packet. PID=10612 in C:\wamp\www\SSDConsultingNew\inc\test.php …
Run Code Online (Sandbox Code Playgroud)

php mysql mysqli database-connection

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