দৃষ্টান্ত পরিষ্কার করার সেরা অনুশীলন
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
এই পৃষ্ঠাটি দৃষ্টান্তগুলি পরিষ্কার করার জন্য সর্বোত্তম অনুশীলনগুলি ব্যাখ্যা করে যখন সেগুলির আর প্রয়োজন নেই৷
নেভিগেশন সেশন সম্পন্ন হলে Navigator#clearDestinations
এবং Navigator#cleanup
ব্যবহার করুন
মেমরি লিক রোধ করতে এবং সঠিক পরিচ্ছন্নতা নিশ্চিত করতে, নেভিগেশন সেশন শেষ হওয়ার পরে Navigator#clearDestinations
এবং Navigator#cleanup
ব্যবহার করুন এবং ন্যাভিগেটর উদাহরণের আর প্রয়োজন নেই। এটি করা যেতে পারে যখন ব্যবহারকারী মানচিত্র থেকে দূরে যান এবং যখন সম্পর্কিত কার্যকলাপের onDestroy()
আহ্বান করা হয়।
GoogleMap
উপাদানগুলি যখন আর প্রয়োজন হয় না তখন পরিষ্কার করুন৷
যদি আপনার অ্যাপটি নন-নেভিগেশন ম্যাপ অভিজ্ঞতার জন্য একটি GoogleMap
দৃষ্টান্ত ব্যবহার করে, তবে এটির আর প্রয়োজন না হলে এই উদাহরণটি পরিষ্কার করতে ভুলবেন না। উদাহরণস্বরূপ, Polygon#remove
, Polyline#remove
এবং Marker#remove
পদ্ধতিতে কল করে GoogleMap
সাথে যুক্ত পলিগন, পলিলাইন এবং মার্কার উপাদানগুলি পরিষ্কার করুন। তারপরে, GoogleMap
ইন্সট্যান্সটি খালি করার পরে এটির আর প্রয়োজন নেই, কল করুন GoogleMap#clear
ইনস্ট্যান্সটিকে null
এ বরাদ্দ করুন।
আপনার অ্যাপে একটি GoogleMap
ইন্সট্যান্স ব্যবহার করার বিষয়ে আরও তথ্যের জন্য, GoogleMap
ইন্টারঅ্যাকশন সেরা অনুশীলনগুলি দেখুন।
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-09-03 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-09-03 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eUse \u003ccode\u003eNavigator#clearDestinations\u003c/code\u003e and \u003ccode\u003eNavigator#cleanup\u003c/code\u003e when navigation sessions are completed to prevent memory leaks.\u003c/p\u003e\n"],["\u003cp\u003eClean up \u003ccode\u003eGoogleMap\u003c/code\u003e elements like Polygons, Polylines, and Markers by calling their respective \u003ccode\u003eremove\u003c/code\u003e methods when they are no longer needed.\u003c/p\u003e\n"],["\u003cp\u003eAfter a \u003ccode\u003eGoogleMap\u003c/code\u003e instance is no longer in use, call \u003ccode\u003eGoogleMap#clear\u003c/code\u003e and assign the instance to \u003ccode\u003enull\u003c/code\u003e to free up resources.\u003c/p\u003e\n"]]],[],null,["# Instance cleanup best practices\n\nThis page explains best practices for cleaning up instances after they are no\nlonger needed.\n\nUse `Navigator#clearDestinations` and `Navigator#cleanup` when navigation sessions are completed\n------------------------------------------------------------------------------------------------\n\nTo prevent memory leaks and ensure proper cleanup, use\n`Navigator#clearDestinations` and `Navigator#cleanup` after the navigation\nsession is completed and the Navigator instance is no longer needed. This can be\ndone when the user has navigated away from the map and when `onDestroy()` of the\nassociated activity is invoked.\n\nClean up `GoogleMap` elements when they are no longer needed\n------------------------------------------------------------\n\nIf your app uses a `GoogleMap` instance for non-navigation maps experiences, be\nsure to clean up this instance when it is no longer needed. For example, clean\nup the Polygon, Polyline, and Marker elements associated with `GoogleMap` by\ncalling the `Polygon#remove`, `Polyline#remove`, and `Marker#remove` methods,\nrespectively. Then, to free up the `GoogleMap` instance after it is not longer\nneeded, call `GoogleMap#clear` assign the instance to `null`.\n\nFor more information about using a `GoogleMap` instance in your app, see\n[`GoogleMap` interaction best\npractices](/maps/documentation/navigation/android-sdk/googlemap-interactions-best-practices)."]]