I think what Damien is trying to tell you is that you are asking the
wrong question.  There is no way, in Java, to force the "deallocation"
of a specific object.  If you remove all references to it, it is, as
far as your program is concerned, gone.  Is there a reason that you
would care whether about whether it exists or not?

-blake
Programming Android, FTW!
 http://oreilly.com/catalog/0636920010364


On Aug 31, 2:40 am, Build account <newandroi...@gmail.com> wrote:
> Hi,
>
> Thank you very much to let me know clearly.
> I tired to use your code snippet, but counldn't get sure.
>
> Another question here,
> If I use below code
> --------
> String a = new String("test");
> String b = a;
>
> b = null;
>
> --------
> In this case,
> the variable 'a' still allocated? Am I right? As long as I keep
> original variable?
>
> On Aug 31, 1:51 pm, Damien Cooke <cooke.dam...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi Build Account,
>
> > Java, the language that Android is programmed in, is garbage collected.  So 
> > all you need to do is let the run time know you are finished with the 
> > object you created.
>
> > for example:
>
> >         //create the object
> >         String language = new String("Java");
>
> >         //use the Object
> >         Log.i("TEST", "Language used is: "+language);
>
> >         //destroy the object
> >         language = null;
>
> > regards
> > Damien
>
> > On 31/08/2011, at 1:14 AM, Build account wrote:
>
> > > Hello all.
>
> > > I'm looking for explictic method to erase object from memory space
> > > wich allocated by 'new' keyword.
>
> > > But the syntax "delete object;" telling me an error that "delete
> > > cannot be resolved".
>
> > > How can I do? I don't believe there is no such kind of 'delete'
> > > method..
>
> > > Please advice me.
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en-Hide quoted text -
>
> > - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to