如何解决为什么 bundle 在对话框中为空?
你好,我在两个对话框之间传递包。在我的第一个对话框中,我将字符串放在一个包中,它们不为空。在我的第二个对话框中,我尝试获取捆绑包并将它们放入字符串中,但捆绑包为空。我之前管理过发送包,但现在使用相同的代码它不起作用并且在第二个片段中为空。 怎么了?
第一个片段
<div class="pageContent broaden">
<div class="container">
<div class="element centered">
<button style="background: rgb(3,182,252);">
<svg width="40" height="40" viewBox="0 0 512 512">
<g style="fill: #fff;">
<g>
<path d="M493.09 351.3L384.7 304.8a31.36 31.36 0 0 0-36.5 8.9l-44.1 53.9A350 350 0 0 1 144.5 208l53.9-44.1a31.35 31.35 0 0 0 8.9-36.49l-46.5-108.5A31.33 31.33 0 0 0 125 .81L24.2 24.11A31.05 31.05 0 0 0 0 54.51C0 307.8 205.3 512 457.49 512A31.23 31.23 0 0 0 488 487.7L511.19 387a31.21 31.21 0 0 0-18.1-35.7zM456.89 480C222.4 479.7 32.3 289.7 32.1 55.21l99.6-23 46 107.39-72.8 59.5C153.3 302.3 209.4 358.6 313 407.2l59.5-72.8 107.39 46z"></path>
</g>
</g>
</svg>
</button>
<span>Call Summit Support on <a href="tel:0400000000">0400 000 000</a> at any time.</span>
<span><b>Primary Student Contact:</b> Mr Tom Carpenter</span>
</div>
<div class="element centered">
<button style="background: rgb(139,195,74);">
<svg width="40" height="40" viewBox="0 0 512 512">
<g style="fill: #fff;">
<g>
<path d="M464 64H48C21.5 64 0 85.5 0 112v288c0 26.5 21.5 48 48 48h416c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM48 96h416c8.8 0 16 7.2 16 16v41.4c-21.9 18.5-53.2 44-150.6 121.3-16.9 13.4-50.2 45.7-73.4 45.3-23.2.4-56.6-31.9-73.4-45.3C85.2 197.4 53.9 171.9 32 153.4V112c0-8.8 7.2-16 16-16zm416 320H48c-8.8 0-16-7.2-16-16V195c22.8 18.7 58.8 47.6 130.7 104.7 20.5 16.4 56.7 52.5 93.3 52.3 36.4.3 72.3-35.5 93.3-52.3 71.9-57.1 107.9-86 130.7-104.7v205c0 8.8-7.2 16-16 16z"></path>
</g>
</g>
</svg>
</button>
<span>Email Summit Support on <a href="mailto:support@summitlms.com">support@summitlms.com</a> or complete the webform contained within the Help button located at the bottom of the left navigation pane for assistance.</span>
</div>
<div class="element centered">
<button style="background: rgb(255,87,34);">
<svg width="40" height="40" viewBox="0 0 448 512">
<g style="fill: #fff;">
<g>
<path d="M224 32c106 0 192 28.75 192 64v32c0 35.25-86 64-192 64S32 163.25 32 128V96c0-35.25 86-64 192-64m192 149.5V224c0 35.25-86 64-192 64S32 259.25 32 224v-42.5c41.25 29 116.75 42.5 192 42.5s150.749-13.5 192-42.5m0 96V320c0 35.25-86 64-192 64S32 355.25 32 320v-42.5c41.25 29 116.75 42.5 192 42.5s150.749-13.5 192-42.5m0 96V416c0 35.25-86 64-192 64S32 451.25 32 416v-42.5c41.25 29 116.75 42.5 192 42.5s150.749-13.5 192-42.5M224 0C145.858 0 0 18.801 0 96v320c0 77.338 146.096 96 224 96 78.142 0 224-18.801 224-96V96c0-77.338-146.096-96-224-96z"></path>
</g>
</g>
</svg>
</button>
<span><a href="#">Click here</a> to access the external Summit knowledge base to access guides in relation to assistance in using the Summit software package.</span>
</div>
</div>
<div class="container">
<div class="element">
<div class="header"><h1>Current release:</h1></div>
<div class="main">
<ul>
<li><b>Summit Suite 2021.1:</b> Welcome to the 2021.1 release of the Summit Suite. This release includes detailed information and processes on all the new functionality,changes and bug fixes. Please <a href="#" target="_blank">click here</a> to view the release notes.</li>
</ul>
</div>
</div>
<div class="element">
<div class="header"><h1>Past releases:</h1></div>
<div class="main">
<p style="text-align: center;"><i>There are no past releases available to view.</i></p>
</div>
</div>
</div>
我的第二个片段
EditText userName,emailAddress,password,repeat;
Button register;
String isntequal;
String pwtoshort;
String wrongEmail;
private static final String TAG = "Register";
TextView openlog,wrongpw,wrongemail;
public static void display(FragmentManager fragmentManager) {
Registration registration = new Registration();
registration.show(fragmentManager,TAG);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NORMAL,R.style.AppTheme_FullScreenDialog);
}
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_registration,container,false);
wrongEmail= getString(R.string.wrongemail);
pwtoshort=getString(R.string.pwtoshort);
isntequal= getString(R.string.isntequal);
wrongemail= view.findViewById(R.id.wrongemail);
wrongpw= view.findViewById(R.id.isntequals);
userName = view.findViewById(R.id.name);
emailAddress = view.findViewById(R.id.EmailAddress);
password = view.findViewById(R.id.Password);
repeat = view.findViewById(R.id.repeatPassword);
register = view.findViewById(R.id.createaccout);
userName.addTextChangedListener(loginTextWatcher);
emailAddress.addTextChangedListener(loginTextWatcher);
password.addTextChangedListener(loginTextWatcher);
repeat.addTextChangedListener(loginTextWatcher);
register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String username = userName.getText().toString();
final String email = emailAddress.getText().toString();
final String Password = password.getText().toString();
final String Repeat = repeat.getText().toString();
if(!(Password.equals(Repeat))){
wrongpw.setText(isntequal);
wrongpw.setVisibility(View.VISIBLE);
}
else if (Password.length()< 8){
wrongpw.setText(pwtoshort);
wrongpw.setVisibility(View.VISIBLE);
}
else if (!isEmailValid(email)){
wrongemail.setText(wrongEmail);
wrongemail.setVisibility(View.VISIBLE);
}
else {
dismiss();
Bundle bundle= new Bundle();
accountverify accountVerify = new accountverify();
bundle.putString("username",username);
bundle.putString("email",email);
Log.d(TAG,"onClick: Hello"+bundle);
accountverify.display(getActivity().getSupportFragmentManager());
accountVerify.setArguments(bundle);
}
}
});
解决方法
您的 accountverify#display()
正在实例化一个要显示的新实例,它与您设置参数包的实例不同。你没有对带参数的实例做任何事情。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。