오류 : android.content.res.Resources $ NotFoundException : 문자열 리소스 ID # 0x1

최대

onClickCreateButton을 클릭 할 때마다 다음과 같이 반환됩니다. android.content.res.Resources $ NotFoundException : 문자열 리소스 ID # 0x1

주요 활동 클래스는 다음과 같습니다.

public class MainActivity extends AppCompatActivity {
    EditText mInput;
    RelativeLayout.LayoutParams layoutParams;
    LinearLayout linearLayout2;
    LinearLayout linearLayout3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mInput = findViewById(R.id.EditText);
        linearLayout2 = findViewById(R.id.LinearLayout2);
        layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        linearLayout3 = new LinearLayout(this);
        linearLayout3.setLayoutParams(layoutParams);
        linearLayout3.setOrientation(LinearLayout.HORIZONTAL);
        linearLayout2.addView(linearLayout3);
    }

    public void onClickCreateButton(View v) {
        LinearLayout temp;
        try {
            Toast.makeText(getApplicationContext(), linearLayout2.getChildCount(), Toast.LENGTH_SHORT).show();
            if (linearLayout2.getChildCount() <= 8) {
                temp = (LinearLayout) linearLayout2.getChildAt(linearLayout2.getChildCount());
                Toast.makeText(getApplicationContext(), temp.getChildCount(), Toast.LENGTH_SHORT).show();
                if (temp.getChildCount() <= 3) {
                    Button button = new Button(this);
                    button.setText(mInput.getText().toString());
                    button.setLayoutParams(layoutParams);
                    linearLayout3.addView(button);
                } else {
                    linearLayout3 = new LinearLayout(this);
                    linearLayout3.setLayoutParams(layoutParams);
                    linearLayout3.setOrientation(LinearLayout.HORIZONTAL);
                    linearLayout2.addView(linearLayout3);
                }
            }
        } catch (Exception ex)
        {
            Toast.makeText(getApplicationContext(), ex+"", Toast.LENGTH_SHORT).show();
        }
    }

activity_main :

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <LinearLayout
            android:id="@+id/LinearLayout2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" />
    </LinearLayout>

누군가가 내 코드의 실수를 지적 할 수 있다면 큰 도움이 될 것입니다. 감사! 건배!

웨이브
Toast.makeText(getApplicationContext(), temp.getChildCount(), Toast.LENGTH_SHORT).show();

temp.getChildCount()를 반환하고 인수를 int받는 Toast.makeText()오버로드 int는 리소스 ID가 될 것으로 예상합니다. String대신에 int를 문자열 로 변환 하여 오버로드를 사용하십시오.

Toast.makeText(getApplicationContext(), "" + temp.getChildCount(), Toast.LENGTH_SHORT).show();

다른 Toast.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

android.content.res.Resources $ NotFoundException : 문자열 리소스 ID # 0x601ee160

분류에서Dev

android.content.res.Resources $ NotFoundException : getResource ()에 액세스하는 동안 문자열 배열 리소스 ID # 0x0

분류에서Dev

android.content.res.Resources $ NotFoundException : 리소스 ID # 0x0 자바 예외

분류에서Dev

android.content.res.Resources $ NotFoundException : 리소스 ID # 0x0

분류에서Dev

android.content.res.Resources $ NotFoundException : Spinner의 리소스 ID # 0x0

분류에서Dev

android.content.res.Resources $ NotFoundException : RecyclerView 사용 중 리소스 ID # 0x0 예외

분류에서Dev

Android에서 오디오가 재생되지 않습니다. android.content.res.Resources $ NotFoundException : 리소스 ID # 0x0

분류에서Dev

오류 : ResourcesNotFoundException : 문자열 리소스 ID # 0x1

분류에서Dev

AlertDialog 오류 문자열 리소스 ID # 0x1

분류에서Dev

android.content.res.Resources $ NotFoundException : Android

분류에서Dev

android.content.res.Resources $ NotFoundException 해결 방법 : 리소스 ID # 0x7f070187 유형 # 0x4가 유효하지 않습니다.

분류에서Dev

Android Resources $ NotFoundException : 리소스 ID # 0x7f020052

분류에서Dev

api19의 android.content.res.Resources $ NotFoundException

분류에서Dev

Resources $ NotFoundException : 리소스 ID # 0x7f040015

분류에서Dev

support_simple_spinner_dropdown_item의 android.content.res.Resources $ NotFoundException

분류에서Dev

xml, android.content.res.Resources $ NotFoundException을 확장 할 수 없습니다.

분류에서Dev

자원 $ NotFoundException : 문자열 리소스 ID 번호 0x0으로

분류에서Dev

"RuntimeException : 수신자를 시작할 수 없음 : Resources $ NotFoundException : 리소스 ID # 0x1050019"를 수정하는 방법?

분류에서Dev

Xamarin에서 조각을 만드는 동안 Android.Content.Res.Resources + NotFoundException 가져 오기

분류에서Dev

드로어 블 이미지를 가져 오려고 할 때 android.content.res.Resources $ NotFoundException 발생

분류에서Dev

드로어 블에서 테마 속성을 사용할 수 없습니다. android.content.res.Resources $ NotFoundException 오류가 발생했습니다.

분류에서Dev

피카소에서 android.R.attr.listPreferredItemHeightLarge 가져 오기 (Resources $ NotFoundException 오류)

분류에서Dev

Resources $ NotFoundException : Motionlayout과 함께 NestedScrollView를 사용하여 리소스 ID # 0xffffffff를 찾을 수 없습니다.

분류에서Dev

Resources $ NotFoundException : 리소스가 ColorStateList (색상 또는 경로)가 아닙니다 :} in android

분류에서Dev

드로어 블 xml 리소스에 대한 Xamarin.Forms Android Resources $ NotFoundException

분류에서Dev

Android 스튜디오 4.1 : XML 리소스 ID 자동 가져 오기 문제

분류에서Dev

Android, 문자열로 리소스 ID를 얻습니까?

분류에서Dev

Android.Content.Res.Resources에는 getObject <T> 만 있습니다.

분류에서Dev

Android Resources $ NotFoundException 충돌 보고서

Related 관련 기사

  1. 1

    android.content.res.Resources $ NotFoundException : 문자열 리소스 ID # 0x601ee160

  2. 2

    android.content.res.Resources $ NotFoundException : getResource ()에 액세스하는 동안 문자열 배열 리소스 ID # 0x0

  3. 3

    android.content.res.Resources $ NotFoundException : 리소스 ID # 0x0 자바 예외

  4. 4

    android.content.res.Resources $ NotFoundException : 리소스 ID # 0x0

  5. 5

    android.content.res.Resources $ NotFoundException : Spinner의 리소스 ID # 0x0

  6. 6

    android.content.res.Resources $ NotFoundException : RecyclerView 사용 중 리소스 ID # 0x0 예외

  7. 7

    Android에서 오디오가 재생되지 않습니다. android.content.res.Resources $ NotFoundException : 리소스 ID # 0x0

  8. 8

    오류 : ResourcesNotFoundException : 문자열 리소스 ID # 0x1

  9. 9

    AlertDialog 오류 문자열 리소스 ID # 0x1

  10. 10

    android.content.res.Resources $ NotFoundException : Android

  11. 11

    android.content.res.Resources $ NotFoundException 해결 방법 : 리소스 ID # 0x7f070187 유형 # 0x4가 유효하지 않습니다.

  12. 12

    Android Resources $ NotFoundException : 리소스 ID # 0x7f020052

  13. 13

    api19의 android.content.res.Resources $ NotFoundException

  14. 14

    Resources $ NotFoundException : 리소스 ID # 0x7f040015

  15. 15

    support_simple_spinner_dropdown_item의 android.content.res.Resources $ NotFoundException

  16. 16

    xml, android.content.res.Resources $ NotFoundException을 확장 할 수 없습니다.

  17. 17

    자원 $ NotFoundException : 문자열 리소스 ID 번호 0x0으로

  18. 18

    "RuntimeException : 수신자를 시작할 수 없음 : Resources $ NotFoundException : 리소스 ID # 0x1050019"를 수정하는 방법?

  19. 19

    Xamarin에서 조각을 만드는 동안 Android.Content.Res.Resources + NotFoundException 가져 오기

  20. 20

    드로어 블 이미지를 가져 오려고 할 때 android.content.res.Resources $ NotFoundException 발생

  21. 21

    드로어 블에서 테마 속성을 사용할 수 없습니다. android.content.res.Resources $ NotFoundException 오류가 발생했습니다.

  22. 22

    피카소에서 android.R.attr.listPreferredItemHeightLarge 가져 오기 (Resources $ NotFoundException 오류)

  23. 23

    Resources $ NotFoundException : Motionlayout과 함께 NestedScrollView를 사용하여 리소스 ID # 0xffffffff를 찾을 수 없습니다.

  24. 24

    Resources $ NotFoundException : 리소스가 ColorStateList (색상 또는 경로)가 아닙니다 :} in android

  25. 25

    드로어 블 xml 리소스에 대한 Xamarin.Forms Android Resources $ NotFoundException

  26. 26

    Android 스튜디오 4.1 : XML 리소스 ID 자동 가져 오기 문제

  27. 27

    Android, 문자열로 리소스 ID를 얻습니까?

  28. 28

    Android.Content.Res.Resources에는 getObject <T> 만 있습니다.

  29. 29

    Android Resources $ NotFoundException 충돌 보고서

뜨겁다태그

보관