我正在嘗試通過從手機(jī)的圖片庫中選擇圖片來上傳圖片。但是選擇它后根本不執(zhí)行任何操作,甚至不上傳它。我已經(jīng)嘗試了干凈的構(gòu)建并重新構(gòu)建仍然沒有幫助。它只是通過說出以下內(nèi)容自動(dòng)斷開連接:V / FA:正在進(jìn)行連接嘗試D / FA:已連接到遠(yuǎn)程服務(wù)V / FA:正在處理排隊(duì)的服務(wù)任務(wù):2 V / FA:不活動(dòng),正在與服務(wù)斷開連接public class MainActivity extends AppCompatActivity { Button uploadButton; ImageView downloadedImage; private static final int CAMERA_REQUEST_CODE=1; private StorageReference storageReference; //private ProgressDialog progressDialog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); uploadButton = findViewById(R.id.button); downloadedImage = findViewById(R.id.imageView); storageReference = FirebaseStorage.getInstance().getReference(); //progressDialog = new ProgressDialog(this); uploadButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent,CAMERA_REQUEST_CODE); Log.i("Done","Till here"); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == CAMERA_REQUEST_CODE && requestCode == RESULT_OK) { Log.i("Not Done","This log is not visible");我得到的錯(cuò)誤是:I / art:拒絕對先前失敗的類java.lang.Class:java.lang.NoClassDefFoundError進(jìn)行重新初始化:無法解決以下問題:Landroid / view / View $ OnUnhandledKeyEventListener;
1 回答

隔江千里
TA貢獻(xiàn)1906條經(jīng)驗(yàn) 獲得超10個(gè)贊
在&&之后將requestCode更改為resultCode,它將起作用。
if(requestCode == CAMERA_REQUEST_CODE && resultCode == RESULT_OK)
{
}
添加回答
舉報(bào)
0/150
提交
取消