是否有可能將android.location.Address
與Intent
的實例加入其他活動?如何發送android.location.Address作爲putextra的意圖
Address current_location;
我的意思是,我試圖通過直接把CURRENT_LOCATION的意圖:
IntentName.putExtra("current_location",current_location);
或間接捆綁:
Bundle b = new Bundle(); b.put....("current_location",current_location); IntentName.put(b);
如果上述策略都不支持「Address」,那麼將Address實例傳遞給另一個活動的最佳方法是什麼? 如果我聲明, public static Address current_location;
並嘗試從其他活動訪問它,那麼不能保證Android將保存current_location數據。或者我錯了?
在這種情況下,應遵循什麼方法?
這對我來說不起作用,對於我發送數據的Activity類來幫助用戶找到儘可能最佳的搜索結果,所以我需要來自Address實例的所有可能的信息。 –
好的。你有沒有嘗試過Parcelable方法?我沒有用太多,但我相信你能在這裏找到一個指南。 –
我已經試過了,它工作。我很欣賞你的指導方針 –