Original problem from the CSDN quiz channels, more solutions, see: http://ask.csdn.net/questions / 1751
Problem Description:
When performing some action needs to pass variables to DialogFragment, Eclipse suggested I use
Fragment # setArguments (Bundle) do not know how to use?
Solution:
Use newInstance
static MyDialogFragment newInstance (int num) {
MyDialogFragment f = new MyDialogFragment ();
/ / Supply num input as an argument.
Bundle args = new Bundle ();
args.putInt ("num", num);
f.setArguments (args);
return f;
} Such acquisition parameters
@ Override<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
mNum = getArguments () getInt ("num");.
...
}
Reply:
Reply:
Reply:
Reply:
Taught ~
Reply:
Reply:
bucuo, thank landlord
Reply:
Learn
Reply:
Reply:
Learn
Reply:
Reply:
Thanks very useful
Reply:
Thank you hugged A good help
Reply:
Thank you, landlord. . . . . . . . . . . . . . . . . . . .
Reply:
Thank you, just to use and useful
No comments:
Post a Comment