我知道辛格尔顿,但在Android的项目,我无法使用它。我在Android的初学者。 请告诉我如何与放大器;在这里我们可以在大数据的Android项目使用的单例。我已经使用了简单的值。
I know about Singleton, but I can't use it in an Android project. I am a beginner in Android. Please tell me how & where we can use Singleton in an Android project for Large Data. I have used it for simple values.
辛格尔顿在Android是一样的辛格尔顿在Java中:
Singleton in Android is the same as Singleton in Java:
有一个基本的单例类的例子:
A basic Singleton class example:
public class AppManager
{
private static AppManager _instance;
private AppManager()
{
}
public synchronized static AppManager getInstance()
{
if (_instance == null)
{
_instance = new AppManager();
}
return _instance;
}
}