Java tutorial
//package com.java2s; //License from project: Open Source License import android.text.TextUtils; public class Main { public static String getLocation(String city, String country) { if (!TextUtils.isEmpty(city) && !TextUtils.isEmpty(country)) { return city + ", " + country; } else if (!TextUtils.isEmpty(city)) { return city; } else if (!TextUtils.isEmpty(country)) { return country; } else { return ""; } } }