public class SharedVariables extends Application
{
public static ArrayList<clsNewsItem> ArrayOfNewsItems;
}
public void onCreate()
{
super.onCreate();
ArrayOfNewsItems = new开发者_如何学JAVA ArrayList<clsNewsItem>();
}
hi i am declared Static Arraylist in application class. i am using this ArrayOfNewsItems in Some of the Activity classes And i will change ArrayOfNewsItems objects dynamically by clear() and Add() methods. My Question is, is it Good Practice to Change Static ArrayList of clsNewsItem objecs number of times..? Can any one tell me please
If your question is just about changing ArrayList
then it doesn't seem to be bad practice. If you're using this container to pass some parameters from on activity to another then it may be a bad solution, but may be the only way to do what you want to do. It depends on the design of your application.
精彩评论