बिटमैप मैनेज करना
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
लिखने की सुविधा आज़माएं
Android के लिए, Jetpack Compose को यूज़र इंटरफ़ेस (यूआई) टूलकिट के तौर पर इस्तेमाल करने का सुझाव दिया जाता है. Compose में ग्राफ़िक दिखाने का तरीका जानें.
Android ऐप्लिकेशन में बिटमैप लोड करना मुश्किल होता है. इसकी कई वजहें हैं:
- बिटमैप, ऐप्लिकेशन के मेमोरी बजट को बहुत आसानी से खत्म कर सकते हैं. उदाहरण के लिए, Pixel फ़ोन का कैमरा, 4048x3036 पिक्सल (12 मेगापिक्सल) तक की फ़ोटो लेता है.
अगर इस्तेमाल किया गया बिटमैप कॉन्फ़िगरेशन
ARGB_8888
है, तो
Android 2.3 (एपीआई लेवल 9) और इसके बाद के वर्शन के लिए डिफ़ॉल्ट रूप से, एक फ़ोटो को मेमोरी में लोड करने में करीब 48 एमबी मेमोरी लगती है (4048*3036*4 बाइट). मेमोरी की इतनी ज़्यादा ज़रूरत होने पर, ऐप्लिकेशन के लिए उपलब्ध पूरी मेमोरी तुरंत इस्तेमाल की जा सकती है.
- यूज़र इंटरफ़ेस (यूआई) थ्रेड पर बिटमैप लोड करने से, आपके ऐप्लिकेशन की परफ़ॉर्मेंस खराब हो सकती है. इसकी वजह से, ऐप्लिकेशन धीरे-धीरे काम करता है या एएनआर की गड़बड़ी वाले मैसेज भी दिख सकते हैं. इसलिए, बिटमैप के साथ काम करते समय थ्रेडिंग को सही तरीके से मैनेज करना ज़रूरी है.
- अगर आपका ऐप्लिकेशन मेमोरी में कई बिटमैप लोड कर रहा है, तो आपको मेमोरी और डिस्क कैशिंग को बेहतर तरीके से मैनेज करना होगा. ऐसा न करने पर, आपके ऐप्लिकेशन के यूज़र इंटरफ़ेस (यूआई) की परफ़ॉर्मेंस पर असर पड़ सकता है.
ज़्यादातर मामलों में, हमारा सुझाव है कि आप अपने ऐप्लिकेशन में बिटमैप फ़ेच करने, डिकोड करने, और दिखाने के लिए Glide लाइब्रेरी का इस्तेमाल करें. Glide, Android पर बिटमैप और अन्य इमेज के साथ काम करने से जुड़े इन और अन्य टास्क को मैनेज करने की जटिलता को कम करता है.
Glide का इस्तेमाल करने और इसे डाउनलोड करने के बारे में जानकारी पाने के लिए, GitHub पर Glide रिपॉज़िटरी पर जाएं.
आपके पास Android फ़्रेमवर्क में पहले से मौजूद लोअर-लेवल एपीआई के साथ सीधे काम करने का विकल्प भी होता है.
इसके बारे में ज़्यादा जानने के लिए, बड़े बिटमैप को असरदार तरीके से लोड करना,
बिटमैप को कैश मेमोरी में सेव करना, और
बिटमैप मेमोरी मैनेज करना लेख पढ़ें.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया."],[],[],null,["# Handling bitmaps\n\nTry the Compose way \nJetpack Compose is the recommended UI toolkit for Android. Learn how to display graphics in Compose. \n[ImageBitmap →](/jetpack/compose/graphics/images/compare) \n\nThere are a number of reasons why loading bitmaps in your Android app is tricky:\n\n- Bitmaps can very easily exhaust an app's memory budget. For example, the camera on the [Pixel](https://www.android.com/phones/pixel/) phone takes photos of up to 4048x3036 pixels (12 megapixels). If the bitmap configuration used is [ARGB_8888](/reference/android/graphics/Bitmap.Config), the default for Android 2.3 (API level 9) and higher, loading a single photo into memory takes about 48MB of memory (4048\\*3036\\*4 bytes). Such a large memory demand can immediately use up all the memory available to the app.\n- Loading bitmaps on the UI thread can degrade your app's performance, causing slow responsiveness or even ANR messages. It is therefore important to manage threading appropriately when working with bitmaps.\n- If your app is loading multiple bitmaps into memory, you need to skillfully manage memory and disk caching. Otherwise, the responsiveness and fluidity of your app's UI may suffer.\n\n\nFor most cases, we recommend that you use the [Glide](https://github.com/bumptech/glide)\nlibrary to fetch, decode, and display bitmaps in your app. Glide abstracts out most of\nthe complexity in handling these and\nother tasks related to working with bitmaps and other images on Android.\nFor information about using and downloading Glide, visit the\n[Glide repository](https://github.com/bumptech/glide) on GitHub.\n\n\nYou can also opt to work directly with the lower-level APIs built into the Android framework.\nFor more information on doing so, refer to\n[Loading Large Bitmaps Efficiently](/topic/performance/graphics/load-bitmap),\n[Caching Bitmaps](/topic/performance/graphics/cache-bitmap), and\n[Managing Bitmap Memory](/topic/performance/graphics/manage-memory).\n\nMore resources\n--------------"]]