[問題] 新手發問

看板AndroidDev作者 (阿昌)時間13年前 (2011/01/12 23:48), 編輯推噓2(203)
留言5則, 2人參與, 最新討論串1/2 (看更多)
Which level: (app/frmwrk/lib/kernel) Question: Input: Expected Output: Wrong Output: Code: (請多利用置底文網站) References: (Books/Websites/...) Supplement: 小弟最近自學於Android上開發,常常遇到需要傳遞Context類別參數傳遞, 對於Context類別敘述原文如下 : Class Overview Interface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system. It allows access to application-specific resources and classes, as well as up-calls for application-level operations such as launching activities, broadcasting and receiving intents, etc 依小弟認知,他是指這類別靠Android系統實現,去允許存取特殊應用的資源跟類別, 要求應用層級操作,如啟動activities、broadcasting和接收intents等,但是 還是有點難以理解,是否有人可以白話一點解釋Context的作用? 另外,傳遞Context context這種參數時(如PendingIntent.getActivity (Context context, int requestCode, Intent intent, int flags) ...等等)為什麼可以用this傳遞? 謝謝大家~~ PS:我是幫朋友PO的,若高手有見解再請回覆到以下mail yashote2003@yahoo.com.tw -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.38.11.33

01/13 02:03, , 1F
1. 千萬不要用這種爛標題,上次有人這樣用,結果...
01/13 02:03, 1F

01/13 02:03, , 2F
2. 因為 Activity 有繼承到 Context,所以傳 this 即可
01/13 02:03, 2F

01/13 02:05, , 3F
最後碎碎唸一下 求助發問還要別人主動寄信到您信箱
01/13 02:05, 3F

01/13 02:06, , 4F
這是討論板阿 老大 不是求神問卦區阿... :(
01/13 02:06, 4F

01/13 12:48, , 5F
看來原PO還兼BBS新手 發問格式也不合喔ˇˇ
01/13 12:48, 5F
文章代碼(AID): #1DBSrCg8 (AndroidDev)
討論串 (同標題文章)
文章代碼(AID): #1DBSrCg8 (AndroidDev)