I've noticed that in the Android reference for Fragments (notably DialogFragment) that they do a couple of things different from what I'd expect:
1). Use public static foo newInstance()
method rather than a constructor.
2). Pass values to onCreateDialog using setArguments rather than member variables.
I've read that newInstance appears to be preferrable when using reflection. However I really don't understand why they're passing parameters via a bundle. I'd have though using member variables would be safer (not using a string to fetch from a map) and would have less of an overhead.
Any thoughts?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…