July 5th, 2012, 06:27 AM
|
#1 (permalink)
|
|
New Member
Thread Author (OP)
Join Date: Mar 2010
Posts: 2
Device(s):
Carrier: Not Provided
Thanks: 0
Thanked 0 Times in 0 Posts
|
Can I use application context to create a view
I am using activity context to create views and I found that we can use application context as well to create them then what is the difference between them. What are the advantages and disadvantages in terms of memory and performance.
Previous code inside activity's onCreate() : TextView v = new TextView(this);
New code inside activity's onCreate() : TextView v = new TextView(getApplicationContext)
On addition of this when I see hprof dump I found that after doing remvoewAllViews from parent view it is not showing this TextView as reference in activity but for old code it was showing.
Please advice what to use when.
Thanks, Pratik
|
|
|