uuidExtra is null How to convert that to String

40 views Asked by At

See String uuids My CODE :

if (uuidExtra != null) {
   for (Parcelable p : uuidExtra) {
       String uuids = ""+p;
   }
}

I'm not programmer. I just learning about it.

1

There are 1 answers

0
Giovanka Bisano On

Can you underline you question here? Do you want to know what is the result of your uuids variable?

If so, the result will be the latest data of your uuidExtra. Because in line 3, you make new variable of uuids.

To make it more clear, let me give some example :

You have a List of string. Let's say a,b,c,d,e. Then you access every index of that List using for. Inside that for, you make a new variable called uuids. The problem is, you make new variable everytime doing a loop. So the result is uuids = e.

If you want to have result like this uuids = a,b,c,d,e. You need to modify your code like this.

String uuids;
if (uuidExtra != null) {
   for (Parcelable p : uuidExtra) {
       uuids = ""+p;
   }
}