【发布时间】:2015-08-30 17:43:39
【问题描述】:
所以我想将路径转换为保存在Sharedpreferences 中的字符串,现在在下一个活动中我正在获取此字符串,但我想再次将此字符串转换为路径。帮帮我,我在谷歌上看过,但找不到任何有用的东西
Class A
final Path currentPath = mCurrentPath;
System.out.println("current path" + currentPath);
SharedPreferences ap = ctx.getSharedPreferences("lastplayed",
ctx.MODE_PRIVATE);
Editor a = ap.edit();
a.putString("pattern", currentPath + "");
a.commit();
Class B
SharedPreferences ap = ctx.getSharedPreferences("lastplayed",
ctx.MODE_PRIVATE);
String path=ap.getString("pattern","0");
现在我想再次将此字符串对象转换为路径。提前感谢,任何帮助将不胜感激。
【问题讨论】:
-
创建应该是可串行化的自定义路径,并通过意图将此自定义路径发送到下一个活动。
-
你能举个例子吗
-
我的答案是否有效?
-
我不知道如何实现它.. 你能做到吗?我会感谢的
-
我没有得到你?