Re: [问题] Android内容提供者

楼主: changyuheng (张昱珩)   2014-09-13 11:44:10
开发 Android app 一 定要知道 Android Developer Reference
http://developer.android.com/reference/packages.html
这上面有所有 public API 的说明。
例如 Uri.getPathSegments() 在这上面也有说明:http://bit.ly/1woBmec
可以看到回传型别是 List<String>,
其中 public abstract E get (int location) 是 List 的 method。
http://developer.android.com/reference/java/util/List.html#get%28int%29
package name 是 android 开头的,source code 在 AOSP 的 frameworks 都找得到,
例如这个 API 的实作就在
http://bit.ly/1pZ2PdM 的这行开始 PathSegments getPathSegments() {
这里面有用到 polymorphism,建议自己追过,很有帮助。
※ 引述《gn00618777 (非常念旧)》之铭言:
: 常看到 uri.getPathSegments().get(1)用法,书上并没有太多着墨
: 不知道 uri.getPathSeqments() 代表的是什么,请问有简易范例?
: get(1)又是什么? 假设我用get(0)呢???
: 谢谢指教,虚心接受。
作者: gn00618777 (非常念旧)   2014-09-14 21:34:00
有种恍然大悟的感觉0...0

Links booklink

Contact Us: admin [ a t ] ucptt.com