- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在开发一个小型应用程序,该应用程序已经过测试并且一直运行良好。当我添加新代码让应用程序将信息发送到我的 Firebase 实时数据库时,它只是不会启动我的应用程序。它会使 MainActivity 闪烁一秒钟然后变黑。
当我删除输入的代码时,enter code here
会继续执行相同的操作。尽管相同的代码(在删除我认为不好的代码之后)之前可以正常工作。我翻遍了论坛,但在 Activity 完成之前没有找到任何引用对话框的代码
,,,
/com.fromfire.fantastysurvivor W/ActivityThread: handleWindowVisibility:
no activity for token android.os.BinderProxy@356e9f5
2019-05-08 07:46:47.891 3306-3306/com.fromfire.fantastysurvivor V/FA:
onActivityCreated
2019-05-08 07:46:47.998 3306-3306/com.fromfire.fantastysurvivor
W/ActivityThread: handleWindowVisibility: no activity for token
android.os.BinderProxy@c10e219
2019-05-08 07:46:48.014 3306-3306/com.fromfire.fantastysurvivor V/FA:
onActivityCreated
2019-05-08 07:46:48.108 3306-3306/com.fromfire.fantastysurvivor
W/ActivityThread: handleWindowVisibility: no activity for token
android.os.BinderProxy@2818389
2019-05-08 07:46:48.116 3306-3306/com.fromfire.fantastysurvivor V/FA:
onActivityCreated
2019-05-08 07:46:48.238 3306-3306/com.fromfire.fantastysurvivor
W/ActivityThread: handleWindowVisibility: no activity for token
android.os.BinderProxy@b4e046d
2019-05-08 07:46:48.254 3306-3306/com.fromfire.fantastysurvivor V/FA:
onActivityCreated
2019-05-08 07:46:48.359 3306-3306/com.fromfire.fantastysurvivor
W/ActivityThread: handleWindowVisibility: no activity for token
android.os.BinderProxy@685e2dd
2019-05-08 07:46:48.383 3306-3306/com.fromfire.fantastysurvivor V/FA:
onActivityCreated
,,,
,,,java
import android.app.ProgressDialog;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.util.HashMap;
import de.hdodenhof.circleimageview.CircleImageView;
public class SetupActivity extends AppCompatActivity
{
private EditText UserName, FullName, CountryName;
private Button SaveInformationButton;
private CircleImageView ProfileImage;
private FirebaseAuth mAuth;
private DatabaseReference UsersRef;
private ProgressDialog loadingBar;
String currentUserID;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setup);
mAuth = FirebaseAuth.getInstance();
currentUserID = mAuth.getCurrentUser().getUid();
UsersRef = FirebaseDatabase.getInstance().getReference().child("Users").child(currentUserID);
UserName = (EditText) findViewById(R.id.setup_username);
FullName = (EditText) findViewById(R.id.set_full_name);
CountryName = (EditText) findViewById(R.id.setup_country_name);
SaveInformationButton = (Button) findViewById(R.id.setup_information_button);
ProfileImage = (CircleImageView) findViewById(R.id.setup_profile_image);
loadingBar = new ProgressDialog(this);
SaveInformationButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
SaveAccountSetupInformation();
}
});
}
private void SaveAccountSetupInformation()
{
String username = UserName.getText().toString();
String fullname = FullName.getText().toString();
String country = CountryName.getText().toString();
if(TextUtils.isEmpty(username))
{
Toast.makeText(SetupActivity.this, "Please enter Username", Toast.LENGTH_SHORT).show();
}
if(TextUtils.isEmpty(fullname))
{
Toast.makeText(SetupActivity.this, "Please enter your full name", Toast.LENGTH_SHORT).show();
}
if(TextUtils.isEmpty(country))
{
Toast.makeText(SetupActivity.this, "Please enter you country", Toast.LENGTH_SHORT).show();
}
else
{
loadingBar.setTitle("Saving information...");
loadingBar.setMessage("Please wait...");
loadingBar.show();
loadingBar.setCanceledOnTouchOutside(true);
HashMap userMap = new HashMap();
userMap.put("username", username);
userMap.put("fullname", fullname);
userMap.put("country", country);
userMap.put("status", "Hey There");
UsersRef.updateChildren(userMap).addOnCompleteListener(new OnCompleteListener()
{
@Override
public void onComplete(@NonNull Task task)
{
if(task.isSuccessful())
{
SendUserToMainActivity();
Toast.makeText(SetupActivity.this, "Account created successfully", Toast.LENGTH_LONG).show();
loadingBar.dismiss();
}
else
{
String message = task.getException().getMessage();
Toast.makeText(SetupActivity.this, "Error occured: " + message, Toast.LENGTH_SHORT).show();
loadingBar.dismiss();
}
}
});
}
}
private void SendUserToMainActivity()
{
Intent mainIntent = new Intent(SetupActivity.this, MainActivity.class);
mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(mainIntent);
}
}
,,,
Build Gradle (App)
,,,
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.fromfire.fantastysurvivor"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-storage:16.0.4'
implementation 'com.google.firebase:firebase-database:16.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.1'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.google.firebase:firebase-messaging:17.6.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
}
apply plugin: 'com.google.gms.google-services'
,,,
MainActivity
,,,java
package com.fromfire.fantastysurvivor;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.support.v4.view.GravityCompat;
import android.support.v7.app.ActionBarDrawerToggle;
import android.view.MenuItem;
import android.support.design.widget.NavigationView;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import com.firebase.ui.auth.AuthUI;
import com.firebase.ui.auth.IdpResponse;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseAuthException;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.Arrays;
import java.util.List;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
private FirebaseAuth mAuth;
private DatabaseReference UsersRef;
String currentUserID;
List<AuthUI.IdpConfig> providers = Arrays.asList(
new AuthUI.IdpConfig.EmailBuilder().build(),
new AuthUI.IdpConfig.GoogleBuilder().build());
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mAuth = FirebaseAuth.getInstance();
UsersRef = FirebaseDatabase.getInstance().getReference().child("Users");
//Navigation Drawer
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("Home");
DrawerLayout drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
navigationView.setNavigationItemSelectedListener(this);
}
@Override
protected void onStart()
{
super.onStart();
FirebaseUser currentUser = mAuth.getCurrentUser();
if(currentUser == null)
{
SendUserToLoginActivity();
}
else
{
CheckUserExistence();
}
}
private void CheckUserExistence()
{
final String current_user_id = mAuth.getCurrentUser().getUid();
UsersRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot)
{
if(!dataSnapshot.hasChild(current_user_id))
{
SendUserToSetupActivity();
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private void SendUserToSetupActivity()
{
Intent setupIntent = new Intent(MainActivity.this, SetupActivity.class);
setupIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(setupIntent);
finish();
}
private void SendUserToLoginActivity()
{
Intent loginIntent = new Intent(MainActivity.this, LoginActivity.class);
loginIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(loginIntent);
finish();
}
public void onBackPressed() {
DrawerLayout drawer = findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
Fragment fragment;
if (id == R.id.nav_leader) {
} else if (id == R.id.nav_mypicks) {
} else if (id == R.id.nav_tribe) {
} else if (id == R.id.nav_results) {
} else if (id == R.id.nav_chat) {
} else if (id == R.id.nav_settings) {
} else if (id == R.id.nav_about) {
} else if (id == R.id.nav_donate) {
} else if (id == R.id.nav_logout) {
mAuth.signOut();
SendUserToLoginActivity();
} else if (id == R.id.nav_feedback) {
} else if (id == R.id.nav_profile) {
} else if (id == R.id.nav_home) {
}
DrawerLayout drawer = findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
,,,
我希望在我与用户一起登录后,让该 uID 引用我的 firebase 数据库,如果没有用户具有该 uID,它将把他们重定向到 SetupActivity 类以获取更多信息输入。
现在屏幕闪烁一瞬间(我猜是在显示我的 MainActivity)然后变黑。
最佳答案
我保存了我所有的代码和 xml 并将其直接粘贴到一个新项目中,问题就消失了。一定是遇到了一些非常隐蔽的错误。
关于java - 如何修复 'handleWindowVisibility: no activity for token android.os.BinderProxy' ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56042692/
我正在开发一个应用程序,它使用 OAuth - 基于 token 的身份验证。 考虑到我们拥有访问和刷新 token ,这就是流程的样子。 Api call -> intercepter append
如何取消标记此代码的输出? 类(class)核心: def __init__(self, user_input): pos = pop(user_input) subject = ""
当我使用命令 kubectl 时与 --token标记并指定 token ,它仍然使用 kubeconfig 中的管理员凭据文件。 这是我做的: NAMESPACE="default" SERVICE
我正在制作 SPA,并决定使用 JWT 进行身份验证/授权,并且我已经阅读了一些关于 Tokens 与 Cookies 的博客。我了解 cookie 授权的工作原理,并了解基本 token 授权的工作
我正在尝试从应用服务获取 Google 的刷新 token ,但无法。 日志说 2016-11-04T00:04:25 PID[500] Verbose Received request: GET h
我正在开发一个项目,只是为了为 java 开发人员测试 eclipse IDE。我是java新手,所以我想知道为什么它不起作用,因为我已经知道该怎么做了。这是代码: public class ecli
我正在尝试使用 JwtSecurityTokenHandler 将 token 字符串转换为 jwt token 。但它出现错误说 IDX12709: CanReadToken() returned
我已阅读文档 Authentication (来自 Facebook 的官方)。我仍然不明白 Facebook 提供的这三种访问 token 之间的区别。网站上给出了一些例子,但我还是不太明白。 每个
我的部署服务器有时有这个问题,这让我抓狂,因为我无法在本地主机中重现,我已经尝试在我的 web.config 中添加机器 key ,但没有成功远。 它只发生在登录页面。 我的布局:
我已经设法获得了一个简单的示例代码,它可以创建一个不记名 token ,还可以通过阅读 stackoverflow 上的其他论坛来通过刷新 token 请求新的不记名 token 。 启动类是这样的
如果我有以前的刷新 token 和使用纯 php 的访问 token ,没有 Google Api 库,是否可以刷新 Google Api token ?我在数据库中存储了许多用户刷新和访问 toke
我通过 Java 应用程序使用 Google 电子表格时遇到了问题。我创建了应用程序,该应用程序运行了 1 年多,没有任何问题,我什至在 Create Spreadsheet using Google
当我有一个有效的刷新 token 时,我正在尝试使用 Keycloak admin REST API 重新创建访问 token 。 我已经通过调用 POST/auth/realms/{realm}/p
我正在尝试让第三方 Java 客户端与我编写的 WCF 服务进行通信。 收到消息时出现如下异常: Cannot find a token authenticator for the 'System.I
在尝试将数据插入到我的 SQl 数据库时,我收到以下错误 System.Data.SqlServerCe.SqlCeException: There was an error parsing the
使用数据库 session token 系统,我可以让用户使用用户名/密码登录,服务器可以生成 token (例如 uuid)并将其存储在数据库中并将该 token 返回给客户端。其上的每个请求都将包
我最近注册了 Microsoft Azure 并设置了认知服务帐户。使用 Text Translation API Documentation 中的说明我能够使用 interactive online
我使用 IAntiforgery API 创建了一个 ASP.Net Core 2 应用程序。 这提供了一种返回 cookie 的方法。 客户端获取该 cookie,并在后续 POST 请求中将该值放
我正在使用 spacy 来匹配某些文本(意大利语)中的特定表达式。我的文本可以多种形式出现,我正在尝试学习编写一般规则的最佳方式。我有如下 4 个案例,我想写一个适用于所有案例的通用模式。像这样的东西
我无法理解 oauth 2.0 token 的原则处理。 我的场景是,我有一个基于 web 的前端后端系统,带有 node.js 和 angular 2。用户应该能够在此站点上上传视频。然后创建一些额
我是一名优秀的程序员,十分优秀!