1
reference.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
    @Override
    public void onComplete(@NonNull Task<DocumentSnapshot> task) {
        if(task.getResult().exists()){
            SkinType = task.getResult().getString("SkinType");
        

        }
    }
});

I want to use SkinType String out of the method on complete

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • 1
    The Firestore APIs (and pretty much all modern cloud APIs) are asynchronous, meaning that you can't return the data from `onComplete` to the outer scope. Any code that needs `SkinType` will need to be inside `onComplete`, be called from there (e.g. with a custom callback), or be otherwise synchronized. This has been covered many times before already, so I linked some existing answers. If you're struggling to make those work for you, it is much more likely that someone can help if you [show what you tried already](http://stackoverflow.com/help/mcve) from those links. – Frank van Puffelen May 15 '22 at 00:08

0 Answers0