作者push583 (阿昌)
看板AndroidDev
標題[問題] 新手發問
時間Wed Jan 12 23:48:26 2011
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
[email protected]
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.38.11.33
1F:推 nowar100:1. 千萬不要用這種爛標題,上次有人這樣用,結果... 01/13 02:03
2F:→ nowar100:2. 因為 Activity 有繼承到 Context,所以傳 this 即可 01/13 02:03
3F:→ nowar100:最後碎碎唸一下 求助發問還要別人主動寄信到您信箱 01/13 02:05
4F:→ nowar100:這是討論板阿 老大 不是求神問卦區阿... :( 01/13 02:06
5F:推 yienge:看來原PO還兼BBS新手 發問格式也不合喔ˇˇ 01/13 12:48