Download Firebase Storage image from variable String

0

This is part of the code of the activity with several attempts to make it work, I have managed to directly put the complete uri but never putting the uri as String

        // Intent
        Intent intent = getIntent();
        gName=intent.getStringExtra( "name" );
        gPath=intent.getStringExtra( "path" );
        gurl=intent.getStringExtra( "url" );
        guri=intent.getStringExtra( "uri" );
        uri = Uri.parse(guri);



        FirebaseStorage storage = FirebaseStorage.getInstance();

        StorageReference storageRef = storage.getReferenceFromUrl( "gs://*****************.com/images/"+gName );
        try {
            final File localFile = File.createTempFile( "images", "jpg" );
            storageRef.getFile( localFile ).addOnSuccessListener( new OnSuccessListener<FileDownloadTask.TaskSnapshot>() {
                @Override
                public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {
                    Bitmap bitmap = BitmapFactory.decodeFile( localFile.getAbsolutePath() );
                    mImage.setImageBitmap( bitmap );

                }
            } ).addOnFailureListener( new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception exception) {
                }
            } );
        } catch (IOException e) {
        }*/


       // StorageReference pathReference = storage.child( "images").child( ""+gName +"");


 // StorageReference httpsReference = storage.getReferenceFromUrl(gUri);


       // Picasso.get().load(gUri).into(mImage);
        // Load the image using Glide

       // Glide.with(this).load(gurl).into(mImage);
        /*
        Glide.with(this )
                .using(new FirebaseImageLoader())
                .load(pathReference)
                .into(mImage);
        */
    
asked by lujan 17.03.2018 в 10:47
source

0 answers