मैं एंड्रॉइड के लिए बहुत नया हूं और मैं इस example का पालन कर रहा हूं।getActivity() जहां इसे परिभाषित किया गया है?
कोड का कहना है हम एक संवाद बॉक्स प्राप्त करने के लिए निम्न चरणों का कार्य करना होगा:
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// 2. Chain together various setter methods to set the dialog characteristics
builder.setMessage(R.string.dialog_message)
.setTitle(R.string.dialog_title);
// 3. Get the AlertDialog from create()
AlertDialog dialog = builder.create();
लेकिन जहां करता getActivity()
विधि परिभाषित किया गया है?
मुझे वह विधि नहीं मिल रही है।
एक विधि बुला के बीच अंतर पता करने के लिए इस तरह 'this.getActivity()' कॉल करने जैसा ही है, इसलिए 'इस' उद्देश्य यह है कि की जरूरत है विधि उपलब्ध है। इस मामले में – JDx
, यह एक टुकड़े में – njzk2