简体   繁体   English

缺少资源 ID android.content.res.Resources$NotFoundException:字符串资源 ID #0xb

[英]missing resource id android.content.res.Resources$NotFoundException: String resource ID #0xb

My app crashes when it moves to the next activity with an error android.content.res.Resources$NotFoundException: String resource ID #0xb.我的应用程序在移动到下一个活动时崩溃,并出现错误 android.content.res.Resources$NotFoundException: String resource ID #0xb。 i'm new to this but would love if you can help我是新手,但如果你能提供帮助我会很高兴

Logcat日志猫

2020-04-21 19:29:39.538 11528-11528/com.twlapps.lumicliosurveys E/lumicliosurvey: Invalid ID 0x0000000b. 2020-04-21 19:29:39.538 11528-11528/com.twlapps.lumicliosurveys E/lumicliosurvey:无效 ID 0x0000000b。 2020-04-21 19:29:39.562 11528-11528/com.twlapps.lumicliosurveys E/AndroidRuntime: FATAL EXCEPTION: main Process: com.twlapps.lumicliosurveys, PID: 11528 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.twlapps.lumicliosurveys/com.twlapps.lumicliosurveys.HomeActivity}: android.content.res.Resources$NotFoundException: String resource ID #0xb at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3344) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3488) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.Z93F725A07423FE1C 2020-04-21 19:29:39.562 11528-11528/com.twlapps.lumicliosurveys E/AndroidRuntime: FATAL EXCEPTION: main Process: com.twlapps.lumicliosurveys, PID: 11528 java.lang.RuntimeException: Unable to start activity ComponentInfo{ com.twlapps.lumicliosurveys/com.twlapps.lumicliosurveys.HomeActivity}: android.content.res.Resources$NotFoundException: String resource ID #0xb at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3344) at android.app. ActivityThread.handleLaunchActivity(ActivityThread.java:3488) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.Z93F725A07423FE1C 889F448B33D21F46Z:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2049) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:216) at android.app.ActivityThread.main(ActivityThread.java:7506) at java.lang.reflect.Method.invoke(Native Method) at com.android. 889F448B33D21F46Z:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2049) at android.os.Handler.dispatchMessage(Handler.java :106) at android.os.Looper.loop(Looper.java:216) at android.app.ActivityThread.main(ActivityThread.java:7506) at java.lang.reflect.Method.invoke(Native Method) at com. android。

Activity活动

        profilecard.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (haveinternet()) {
                String profile = "yes";

                Intent profilesurveys = new Intent(HomeActivity.this, SurveysActivity.class);
                profilesurveys.putExtra("profile",profile);
                startActivity(profilesurveys);
                finish();
            } else if (!haveinternet()) {
                Toast.makeText(HomeActivity.this,"No internet Connection", Toast.LENGTH_LONG).show();
            }
        }
    });

    Calendar cal = Calendar.getInstance();
    if (Calendar.HOUR_OF_DAY >= 4 && Calendar.HOUR < 12 ){
        Toast.makeText(HomeActivity.this,String.valueOf(Calendar.HOUR_OF_DAY), Toast.LENGTH_LONG).show();
        gettime.setText("Good Morning, How was your night?");
    }else  if (Calendar.HOUR_OF_DAY >= 23 && Calendar.HOUR_OF_DAY < 4 ) {
        gettime.setText("Good Night, Have a nice sleep!");
    }else if (Calendar.HOUR_OF_DAY >= 18 && Calendar.HOUR_OF_DAY < 23 ) {
        gettime.setText("Good Evening, How was your day?");
    }else if (Calendar.HOUR_OF_DAY >= 12 && Calendar.HOUR_OF_DAY < 18 ) {
        gettime.setText("Good Afternoon!");
    }


    if (haveinternet()) {
        String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();

        DocumentReference documentReference = firebaseFirestore.collection("USERS").document(uid);
        documentReference.addSnapshotListener(this, new EventListener<DocumentSnapshot>() {
            @Override
            public void onEvent(@Nullable DocumentSnapshot documentSnapshot, @Nullable FirebaseFirestoreException e) {
                if (documentSnapshot.exists()) {
                    String profilechek = documentSnapshot.getString("profile");
                    if (profilechek.equals("false")){
                        profileimgcheck.setVisibility(View.INVISIBLE);
                    }else if (profilechek.equals("true")){
                        profileimgcheck.setVisibility(View.VISIBLE);
                    }
                    String othercheck = documentSnapshot.getString("others");
                    if (othercheck.equals("false")){
                        othersimgcheck.setVisibility(View.INVISIBLE);
                    }else if (othercheck.equals("true")){
                        othersimgcheck.setVisibility(View.VISIBLE);
                    }
                    String followceck = documentSnapshot.getString("followtwitter");
                    if (followceck.equals("false")){
                        followcheck.setVisibility(View.INVISIBLE);
                    }else if (followceck.equals("true")){
                        followcheck.setVisibility(View.VISIBLE);
                    }

                    getYourName.setText(documentSnapshot.getString("fullname"));
                    getYourMoney.setText(String.valueOf(documentSnapshot.getString("Amount")));

                }else {
                    Toast.makeText(HomeActivity.this,"An error occurred... Try again or contact support", Toast.LENGTH_LONG).show();
                }
            }
        });

Please what can i do?请问我能做什么?

I don't see the entire activity but based on the logs and code you posted, the problem may be with我没有看到整个活动,但根据您发布的日志和代码,问题可能出在

String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();

The getUid() may be giving you an integer and you are assigning it to a String value. getUid() 可能会给您一个 integer 并且您将其分配给一个字符串值。

Looks like you haven't registered your Activity in the AndroidManifesto file.看起来你还没有在 AndroidManifesto 文件中注册你的活动。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 android.content.res.Resources$NotFoundException · 字符串资源 ID # - android.content.res.Resources$NotFoundException · String resource ID # android.content.res.Resources $ NotFoundException:资源ID#0x0 - android.content.res.Resources$NotFoundException: Resource ID #0x0 android.content.res.Resources $ NotFoundException:无法找到资源ID - android.content.res.Resources$NotFoundException: Unable to find resource ID 由 android.content.res.Resources$NotFoundException 引起:即使资源存在,资源 ID 也可绘制(缺少名称) - Caused by android.content.res.Resources$NotFoundException: Drawable (missing name) with resource ID even the resource is there GridView.FATAL例外:main android.content.res.Resources $ NotFoundException:字符串资源ID#0x0 - GridView.FATAL EXCEPTION: main android.content.res.Resources$NotFoundException: String resource ID #0x0 无法访问变量-android.content.res.Resources $ NotFoundException:字符串资源ID - Can't get access to variables - android.content.res.Resources$NotFoundException: String resource ID android.content.res.Resources $ NotFoundException:字符串资源ID#0x2 - android.content.res.Resources$NotFoundException: String resource ID #0x2 android.content.res.Resources$NotFoundException: 字符串资源 ID #0x0 - android.content.res.Resources$NotFoundException: String resource ID #0x0 android.content.res.Resources$NotFoundException:字符串资源 ID #0xff000000 - android.content.res.Resources$NotFoundException: String resource ID #0xff000000 如何消除这个错误 (android.content.res.Resources$NotFoundException: String resource ID #0xffffffff) - how to remove this error (android.content.res.Resources$NotFoundException: String resource ID #0xffffffff)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM