Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.location.Address;

public class Main {
    public static String getAddressString(Address address) {
        if (address.getMaxAddressLineIndex() == -1) {
            return null;
        }
        StringBuilder addressStringBuilder = new StringBuilder();
        for (int i = 0; i <= address.getMaxAddressLineIndex(); i++) {
            addressStringBuilder.append(address.getAddressLine(i));
            if (i != address.getMaxAddressLineIndex()) {
                addressStringBuilder.append(", ");
            }
        }
        return addressStringBuilder.toString();
    }
}