create Location - Android Map

Android examples for Map:Location

Description

create Location

Demo Code

/*/*w  w  w .  j  a  v  a 2  s.  c  o  m*/
 * Copyright 2014-2015 ?g Project Team
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
//package com.java2s;
import android.location.Location;
import android.os.Bundle;

public class Main {
    public static Location create(String source) {
        return new Location(source);
    }

    public static Location create(String source, double latitude,
            double longitude, float accuracy) {
        Location location = create(source);
        location.setLatitude(latitude);
        location.setLongitude(longitude);
        location.setAccuracy(accuracy);
        return location;
    }

    public static Location create(String source, double latitude,
            double longitude, float altitude, Bundle extras) {
        Location location = create(source, latitude, longitude, altitude);
        location.setExtras(extras);
        return location;
    }

    public static Location create(String source, double latitude,
            double longitude, double altitude, float accuracy) {
        Location location = create(source, latitude, longitude, accuracy);
        location.setAltitude(altitude);
        return location;
    }

    public static Location create(String source, double latitude,
            double longitude, double altitude, float accuracy, Bundle extras) {
        Location location = create(source, latitude, longitude, altitude,
                accuracy);
        location.setExtras(extras);
        return location;
    }

    public static Location create(String source, long time) {
        Location location = create(source);
        location.setTime(time);
        return location;
    }

    public static Location create(String source, long time, Bundle extras) {
        Location location = create(source, time);
        location.setExtras(extras);
        return location;
    }
}

Related Tutorials