URI imageUri = null;
//Setting the Uri of aURL to imageUri.
try {
imageUri = aURL.toURI();
} catch (URISyntaxException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
我正在使用此代码将URL转换为URI。我怎么能将imageUri保存到SharedPreferences或者它不会被删除的内存onDestroy()?如何使用SharedPreferences保存URI或任何存储?
我不想做SQLite数据库,因为当URL的change.I不想使用了未使用的URI的
在他的示例代码中,他使用了具有.create(String)而不是.aprse(String)的java.net.URI对象,如android.net.Uri。在其他方面使用其中一种有好处吗? – FoamyGuy
我实际上认为android.net.Uri是OP试图保存到共享偏好的东西。如果不是,你的答案肯定是正确的。 – Kal
我认为他们都会工作,而且我从来没有遇到过任何其他理由 – FoamyGuy