отсутствует идентификатор ресурса android .content.res.Resources $ NotFoundException: строковый идентификатор ресурса # 0xb - PullRequest
0 голосов
/ 21 апреля 2020

Мое приложение аварийно завершает работу при переходе к следующему действию с ошибкой android .content.res.Resources $ NotFoundException: строковый идентификатор ресурса # 0xb. Я новичок в этом, но буду рад, если вы сможете помочь

Logcat

2020-04-21 19: 29: 39.538 11528-11528 / com.twlapps.lumicliosurveys E / lumicliosurvey: Invalid ID 0x0000000b. 2020-04-21 19: 29: 39.562 11528-11528 / com.twlapps.lumicliosurveys E / AndroidRuntime: ИСКЛЮЧИТЕЛЬНОЕ ИСКЛЮЧЕНИЕ: основной Процесс: com.twlapps.lumicliosurveys, PID: 11528 java .lang.RuntimeException: невозможно запустить действие ComponentInfo {com.twlapps.lumicliosurveys / com.twlapps.lumicliosurveys.HomeActivity}: android .content.res.Resources $ NotFoundException: строковый идентификатор ресурса # 0xb в android .app.ActivityThread.performLaunchActivity (ActivityThread *read5read *read *read5 : 3344) в android .app.ActivityThread.handleLaunchActivity (ActivityThread. java: 3488) в android .app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem. java: 83) в android .app. servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor. java: 135) в android .app.servertransaction.TransactionExecutor.execute (TransactionExecutor. java: 95) в android .app.ActivityThread $ H.handleMessage (ActivityThread. java: 2049) в android .os.Handler.dispatchMessage (Обработчик. java: 106) в android .os.Looper.l oop (Looper. java: 216) в android .app.Activi tyThread.main (ActivityThread. java: 7506) в java .lang.reflect.Method.invoke (собственный метод) в 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();
                }
            }
        });

Пожалуйста, что я могу сделать?

Ответы [ 2 ]

0 голосов
/ 22 апреля 2020

Я не вижу всей активности, но на основании опубликованных вами журналов и кода проблема может быть в

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

Возможно, getUid () дает вам целое число, а вы его назначаете в строковое значение.

0 голосов
/ 21 апреля 2020

Похоже, вы не зарегистрировали свою активность в файле AndroidManifesto.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...