https://kotlinlang.org logo
#android
Title
# android
t

TarunY

06/09/2020, 9:25 AM
Hello Everyone, Leakcanary gives me the log as below. can please some one suggest me to resolve this
k

Karol Ksionek

06/09/2020, 9:47 AM
Your onItemClickListener has a reference to the activity
t

TarunY

06/09/2020, 9:49 AM
okay..let me check this..
@Karol Ksionek thanks for the help
👍 1
@Karol Ksionek can please suggest me the for below error too. i am directly using as TexttoSpeech class in many activity
Copy code
TexttoSpeech(this ,"Starting Object Search Assistance")
k

Karol Ksionek

06/09/2020, 1:04 PM
Are you using Activity context in order to create TexttoSpeech instance? If so, you need to clean it up in Activity’s onDestroy (or earlier), or use application context. Depending on the use case.
t

TarunY

06/09/2020, 1:09 PM
let me check this.
@Karol Ksionek yes i replaced application context with activity context for creating TexttoSpeech instance. Then there was no memory leak. thanks for the help alot. so please correct me if understanding is wrong. application context handle destroying the instance of all the class through out application
thank you for suggestions :)
11 Views