Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
To upload images to Firebase Storage I am attaching addOnSuccessListener on the instance of the StorageReference. While overriding onSuccess method I am calling getDownloadUrl() on the instance of taskSnapshot but it is giving me an error saying
addOnSuccessListener
onSuccess
getDownloadUrl()
taskSnapshot
Can't resolve method getDownloadUrl()
This app I had created 2 months ago, earlier this app was working fine and getDownloadUrl() was working fine as well. Also, in taskSnapshot instance when I press Ctrl+space, in the suggestions I don't find getDownloadUrl() method. Why is it happening?
Code to onActivityResult():
onActivityResult()
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == RC_SIGN_IN) { if (resultCode == RESULT_OK) { Toast.makeText(this, "Signed in!!!1", Toast.LENGTH_SHORT).show(); } else if (resultCode == RESULT_CANCELED) { Toast.makeText(this, "Failed to sign in", Toast.LENGTH_SHORT).show(); finish(); } } else if(requestCode == RC_PHOTO_PICKER && resultCode == RESULT_OK){ Uri selectedPhoto = data.getData(); StorageReference localRefrence = storageReference.child(selectedPhoto.getLastPathSegment()); // Uploading the file on the storage localRefrence.putFile(selectedPhoto).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { Uri downloadUrl = taskSnapshot.getDownloadUrl(); FriendlyMessage message = new FriendlyMessage(mUsername, null, downloadUrl.toString()); databaseReference.push().setValue(message); } }); } }
buttonSetup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String name = editText_name.getText().toString(); if (!TextUtils.isEmpty(name) && mainImageURI != null) { final String user_id = firebaseAuth.getCurrentUser().getUid(); progressBar_setup.setVisibility(View.VISIBLE); final StorageReference image_path = storageReference.child("profile_images").child(user_id + ".jpg"); UploadTask uploadTask = image_path.putFile(mainImageURI); uploadTask.continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() { @Override public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception { if(!task.isSuccessful()){ throw task.getException(); } return image_path.getDownloadUrl(); } }).addOnCompleteListener(new OnCompleteListener<Uri>() { @Override public void onComplete(@NonNull Task<Uri> task) { if (task.isSuccessful()){ Uri downloadUrl = task.getResult(); Log.i("The URL : ", downloadUrl.toString()); } } }); } } });
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.