make singleton object using xml in android
Is their any way to make singleton object by using xml.As we know if we write className with package it call the constructor of the c开发者_如何学Class but i want to use this xml in various other xml files using include tag.But it call all the time its consturctor and creating various object of that.
<jp.ne.biglobe.common.CustomSlidingDrawer>
something
</jp.ne.biglobe.common.CustomSlidingDrawer>
it call the constructor of the CustomSlidingDrawer class As i included it several other file. Please Suggest me how to make it singleton object.
Maybe you could create a normal class, not singleton that you instanciate through xml. All instances would have a static method getView that returns the singleton.
But this would be awfull design. Just a syntactic workaround.
Regards, Stéphane
精彩评论