Skip to content Skip to sidebar Skip to footer

How Can I Add A String With Multiple Data To String Array

i want to add the string from actorImages in MainActivity.java to String[] getActorsUrls() in another class MainActivity.java DatabaseReference reference = FirebaseDatabase.getIns

Solution 1:

You'll need to create a method called addActorUrls(String url) within ImageUrlUtils and then call it within your loop:

// looping aboveString  actorImages = ds.child("image").getValue(String.class);
ImageUrlUtils.addActorUrls(actorImages);  // This should set our private String[] url property

Solution 2:

I think you have a problem on the urls, try this :D

ImageUrlUtils.java

publicstaticString[] getActorsUrls() {
    String[] urls = newString[]{
            "string 1",
            "string 2",
    };
    return urls;
}

Hope it works

Post a Comment for "How Can I Add A String With Multiple Data To String Array"