我以前從未使用Google Places,並認爲是時候這樣做了。 我已經按照這個教程:http://www.androidhive.info/2012/08/android-working-with-google-places-and-maps-tutorial/Android - 試圖實施Google Places API
我的問題是,當我創建這個方法createRequestFactory()
它說,JsonHttpParser
類現在已經過時。我到處尋找替代解決方案,但一直未能如此。我針對Android 2.1並在Eclipse Juno中開發。有沒有人有任何線索如何解決這場衝突?我沒有收到任何編譯錯誤,並且eclipse正在構建它,沒有任何問題,但我不想使用這個已棄用的類。
這裏是我的代碼:
public static HttpRequestFactory createRequestFactory(
final HttpTransport transport) {
return transport.createRequestFactory(new HttpRequestInitializer() {
public void initialize(HttpRequest request) {
GoogleHeaders headers = new GoogleHeaders();
headers.setApplicationName("AndroidHive-Places-Test");
request.setHeaders(headers);
// deprecated this last two lines
JsonHttpParser parser = new JsonHttpParser(new JacksonFactory());
request.addParser(parser);
}
});
}
提前感謝!
你能解釋一下你的答案嗎? –