在看 design pattern,想到用 singleton:
初学,不知道对不对好像也大材小用了些。public class Address_book_View {
protected Address_book_View() {
// constructor. . .
}
public static Address_book_View getInstance() {
if (_instance == null)
_instance = new Address_book_View();
return _instance;
}
private static Address_book_View _instance=null;
//....
} 你的代码改为 Address_book_View ff=Address_book_View.getInstance();
初学,不知道对不对好像也大材小用了些。public class Address_book_View {
protected Address_book_View() {
// constructor. . .
}
public static Address_book_View getInstance() {
if (_instance == null)
_instance = new Address_book_View();
return _instance;
}
private static Address_book_View _instance=null;
//....
} 你的代码改为 Address_book_View ff=Address_book_View.getInstance();
谢就一个字!搞定!