어떻게 받을 수 있 FileChooser 을 채우 뷰 동안 TableRow creation?

0

질문

문제가: 하는 데 문제가 있습니다터 FileChooser 클래스를 채우 TextViewTableRow 창조이다. 나는 수신 Invocation Exception 안드로이드에서 만들어진"looper.java"나타나는 것에 의해 발생하는 변수 tagTrace=0 읽는 것으로"!=0"입니다. 그래서,저는 확실하지 않는 방법을 해결 방법이다.

내가 무엇을 하려고: 저는 노력을 구축 기존 과정입니다. 를 클릭할 때에"+"버튼을 헤더의 행 TableLayout만듭니다,그 행로는 두 보"삭제"(-) Button 에서 행이 있습니다.아동(0)고 TextView 에서 행이 있습니다.아동(1). 그것이 성공하였습니다. 가 Singleton 클래스를 관리하는 다양한 종류의 TableRow 창작물에 대한 모든 응용 프로그램 Actiities.

에서 하나의 특별한 Activity 이 존재하는 파일 TableLayout. 내가 원하는 사용자를 클릭할 때에"+"-장치의 온도를 참조 나는 위에서 설명을 시작 FileChooser 을 캡처하는 파일의 경로를 채우는 경로를 TextView 아이의 행을 만드는 것입니다. 그러나 나으로 실행하는 것이 문제다.

이 Looper.java 버그(나는 생각한다)호출을 일으키는 예외

Looper Bug

이 FileChooser

    public class FileChooser extends AppCompatActivity {
        private String fileName;
        private String filePath;
        private final ActivityResultLauncher<Intent> resultLauncher;
    
        public FileChooser(){
            //if(intent==null) Toast.makeText(null, "Intent is Null", Toast.LENGTH_SHORT).show();
            this.resultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
                if (result.getResultCode() == Activity.RESULT_OK && result.getData() != null){
                    Uri uri = result.getData().getData();
                    filePath = uri.getPath();
                }
            });
        }
    
        public String getFileName() {
            return fileName;
        }
    
        public String getFilePath() {
            return filePath;
        }
    
        public ActivityResultLauncher<Intent> getResultLauncher() {
            return resultLauncher;
        }

}

메소드 내에서 단일 창조 TableRow 에"!굵은"

public static TableRow setupFilesTableRow(Context context, TableLayout table, String fileID, String fileName, boolean bold) {
    TableRow row = new TableRow(context);
    if(bold) {
        row.addView(setupFilesAddRowButton(context, table));
        row.addView(addRowTextViewToTable(context, fileName, true));
    }
    if (!bold) {
        row.addView(setupDeleteRowButton(context, table));
        
            // Intent and FileChooser to capture a filePath
            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
            intent.setType("*/*");
            FileChooser fileChooser = new FileChooser();
            fileChooser.getResultLauncher().launch(intent);

            // Adding a TextView child to the new TableRow with the captured filePath from the FileChooser
            row.addView(addRowTextViewToTable(context, fileChooser.getFilePath(), false));
            //row.setClickable(true);
        
    }
    return row;
}
android filechooser java tablerow
2021-10-21 13:18:53
1
1

FileChooser fileChooser=new FileChooser();

할 수 없습니다 새로 만들고 활동 new 연산자입니다.

활동 시작용도 있었습니다.

2021-10-21 13:38:09

나는 생각하지 않는 물론,는 것입니다.
svstackoverflow

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................