improved json conversion

This commit is contained in:
paul-loedige 2021-01-04 17:30:10 +01:00
parent 98a4bed7b0
commit 7fadd4771f
2 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,5 @@
package com.example.aped.communication;
import android.content.Context;
import android.graphics.Color;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;

View File

@ -247,10 +247,14 @@ public class ConfigurationHandler implements IFAVORITES {
@NonNull
@Override
public String toString() {
List<String> favoriteNamesString = new ArrayList<>();
for (String favoriteName : favoriteNames){
favoriteNamesString.add("\"" + favoriteName + "\"");
}
return "{\n"
+ "\"address\":\"" + address + "\",\n"
+ "\"port\":\"" + port + "\",\n"
+ "\"favorites\":" + favoriteNames.toString() + "\n"
+ "\t\"address\":\"" + address + "\",\n"
+ "\t\"port\":\"" + port + "\",\n"
+ "\t\"favorites\":" + favoriteNamesString.toString() + "\n"
+ "}";
}
}