July 5th, 2012, 06:27 AM
Thread Author (OP)
Join Date: Mar 2010
Carrier: Not Provided
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.