当前位置: 编程技术>移动开发
本页文章导读:
▪Calendar账号的门类 Calendar账号的类型
Calendar账号有几种类型呢 ?
1.com.android.exchange
2.com.android.google
用户如何知道账号类型呢?
根据配置账号时的选择,如果选择exchange方式,类型自然是exchange的.........
▪ 透过Location获取Address的使用 通过Location获取Address的使用!
我们获取Location的目的之一肯定是有获取这个位置的详细地址,而我们有了Location在来获取Address就相对简单多了,因为GoogleApi已经封装好了方法,我们只需呀.........
▪ 关于google checkout收款有关问题-已经解决了,哈哈 关于google checkout收款问题-已经解决了,哈哈
困扰开发者很久的google checkout收款问题,终于让我解决了,我找了很多方式方法,发现这个最方便快捷安全。并且有自己的银行卡(美国银行.........
[1]Calendar账号的门类
来源: 互联网 发布时间: 2014-02-18
Calendar账号的类型
Calendar账号有几种类型呢 ?
1.com.android.exchange
2.com.android.google
用户如何知道账号类型呢?
根据配置账号时的选择,如果选择exchange方式,类型自然是exchange的,同理,选择google market方式配置账
号,就是google类型的。
当然,用户不用关心这些,但是作为一个开发者,知道这些细节更有利于我们分析问题,解决问题。
如果开发者想自己添加一个本地账号,那么他很有可能自己定义一种类型,比如说com.android.local。
[2] 透过Location获取Address的使用
来源: 互联网 发布时间: 2014-02-18
通过Location获取Address的使用!
我们获取Location的目的之一肯定是有获取这个位置的详细地址,而我们有了Location在来获取Address就相对简单多了,因为GoogleApi已经封装好了方法,我们只需呀通过Location获取GeoPoint,然后在通过GeoPoint来获取我们想要的Address.下面是我做的一个简单的Demo.
第二步: 修改main.xml
第三步:修改LocationDemo.java(增加了两个方法)代码如下:
第四步:最重要一步在AndroidManiefest.xml中导入Google Api(第14行代码)库,代码如下:
我们获取Location的目的之一肯定是有获取这个位置的详细地址,而我们有了Location在来获取Address就相对简单多了,因为GoogleApi已经封装好了方法,我们只需呀通过Location获取GeoPoint,然后在通过GeoPoint来获取我们想要的Address.下面是我做的一个简单的Demo.
第二步: 修改main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/longitude"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="longitude:"
/>
<TextView
android:id="@+id/latitude"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="latitude:"
/>
<TextView
android:id="@+id/address"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>第三步:修改LocationDemo.java(增加了两个方法)代码如下:
package com.android.tutor;
import java.util.List;
import java.util.Locale;
import com.google.android.maps.GeoPoint;
import android.app.Activity;
import android.content.Context;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.TextView;
public class LocationDemo extends Activity {
private TextView longitude;
private TextView latitude;
private TextView address;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
longitude = (TextView)findViewById(R.id.longitude);
latitude = (TextView)findViewById(R.id.latitude);
address = (TextView)findViewById(R.id.address);
Location mLocation = getLocation(this);
GeoPoint gp = getGeoByLocation(mLocation);
Address mAddress = getAddressbyGeoPoint(this, gp);
longitude.setText("Longitude: " + mLocation.getLongitude());
latitude.setText("Latitude: " + mLocation.getLatitude());
address.setText("Address: " + mAddress.getCountryName()+"," + mAddress.getLocality());
}
//Get the Location by GPS or WIFI
public Location getLocation(Context context) {
LocationManager locMan = (LocationManager) context
.getSystemService(Context.LOCATION_SERVICE);
Location location = locMan
.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (location == null) {
location = locMan
.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
}
return location;
}
//通过Location获取GeoPoint
public GeoPoint getGeoByLocation(Location location) {
GeoPoint gp = null;
try {
if (location != null) {
double geoLatitude = location.getLatitude() * 1E6;
double geoLongitude = location.getLongitude() * 1E6;
gp = new GeoPoint((int) geoLatitude, (int) geoLongitude);
}
} catch (Exception e) {
e.printStackTrace();
}
return gp;
}
//通过GeoPoint来获取Address
public Address getAddressbyGeoPoint(Context cntext, GeoPoint gp) {
Address result = null;
try {
if (gp != null) {
Geocoder gc = new Geocoder(cntext, Locale.CHINA);
double geoLatitude = (int) gp.getLatitudeE6() / 1E6;
double geoLongitude = (int) gp.getLongitudeE6() / 1E6;
List<Address> lstAddress = gc.getFromLocation(geoLatitude,
geoLongitude, 1);
if (lstAddress.size() > 0) {
result = lstAddress.get(0);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}第四步:最重要一步在AndroidManiefest.xml中导入Google Api(第14行代码)库,代码如下:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.tutor"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".LocationDemo"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
</application>
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
</manifest>
[3] 关于google checkout收款有关问题-已经解决了,哈哈
来源: 互联网 发布时间: 2014-02-18
关于google checkout收款问题-已经解决了,哈哈
困扰开发者很久的google checkout收款问题,终于让我解决了,我找了很多方式方法,发现这个最方便快捷安全。
并且有自己的银行卡(美国银行账户),可以转账到国内,并且可以网上银行管理,具体步骤,我就不在这里写了,因为鱼龙混杂,很多人也不做国外,并且也不需要google checkout收款,知道人多,我害怕把这个路子也封闭了。
有需求的可以给我发邮件,我会在邮件中告知是哪个银行,哪个卡片,如何申请。
sampson3333@163.com
不是广告贴哈,一切为了人民服务,哈哈。注明一下,你需要美国账户收google checkout里的钱,还想要自己的美国银行个人账户的人找我,其他勿扰。
困扰开发者很久的google checkout收款问题,终于让我解决了,我找了很多方式方法,发现这个最方便快捷安全。
并且有自己的银行卡(美国银行账户),可以转账到国内,并且可以网上银行管理,具体步骤,我就不在这里写了,因为鱼龙混杂,很多人也不做国外,并且也不需要google checkout收款,知道人多,我害怕把这个路子也封闭了。
有需求的可以给我发邮件,我会在邮件中告知是哪个银行,哪个卡片,如何申请。
sampson3333@163.com
不是广告贴哈,一切为了人民服务,哈哈。注明一下,你需要美国账户收google checkout里的钱,还想要自己的美国银行个人账户的人找我,其他勿扰。
最新技术文章: