Go Back   Android Forums > Android Discussion > Android Lounge
Android Lounge A place for general Android discussion and questions.

test: Reply
 
LinkBack Thread Tools
Old 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
Default 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

Advertisements
pratikatcsam is offline  
Reply With Quote
sponsored links
Reply


Go Back   Android Forums > Android Discussion > Android Lounge
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:11 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.