这是我在这里输入图像描述的错误
public class ProfileFragment extends Fragment {
TextView profileNames,ProfileRegNumber;
String regnumber;
String Student_URL ="http://192.168.43.244/ULKandroid/student.php";
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_profile,container,false);
//HomeActivity homeActivity = new HomeActivity();
profileNames = (TextView) v.findViewById(R.id.txtProfileNames);
ProfileRegNumber = (TextView) v.findViewById(R.id.txtProfileRegNo);
String n = this.getArguments().getString("names");
String r = this.getArguments().getString("reg");
profileNames.setText(n);
ProfileRegNumber.setText(r);
return v;
}
}
我得到的错误是这样的
11-08 11:54:12.604 415 4-4154/Cards.inkuge.com.ulkStudent e/AndroidRuntime:致命异常:主进程:Cards.inkuge.com.ulkStudent,PID:4154 java.lang.nullPointerException位于Cards.inkuge.com.ulkStudent.Fragments.ProfileFragment.onCreateView(ProfileFragment.java:46)位于AndroidX.Fragment.App.Fragment.PerformCreateView(Fragment.java:2600)位于在Androidx.fragment.app.fragmentManagerimpl.execpendingActions(FragmentManagerimpl.java:1727)在Androidx.fragment.app.fragmentManagerimpl.java:1727)在Android.os.handler.handleCallback(handler.java:733)在Android.os.handler.dispatchMessage(handler.java:95)在Android.os.looper.loop(looper.java:136)在Android.app.activitythread.main(
这是一个设置参数的activity吗
else {
Intent intent = new Intent(LoginActivity.this,HomeActivity.class);
Bundle bundle = new Bundle();
bundle.putString("names",jsonObject.getString("student_names"));
bundle.putString("reg",jsonObject.getString("regnumber_student"));
ProfileFragment fragment = new ProfileFragment();
bundle.putString("names",jsonObject.getString("student_names"));
bundle.putString("reg",jsonObject.getString("regnumber_student"));
fragment.setArguments(bundle);
intent.putExtras(bundle);
startActivity(intent);
clear();
finish();
}
您应该创建类似于以下内容的片段:
public static ProfileFragment NewInstance(String names, String reg) {
ProfileFragment fragment = new ProfileFragment();
Bundle bundle = new Bundle();
bundle.putString("names", names);
bundle.putString("reg", reg);
fragment.setArguments(bundle);
return fragment;
}
还要确保您有这样的构造函数
public ProfileFragment() {
// Required empty public constructor
}
在此片段中定义全局变量,如下所示:
private String _names;
private String _reg;
重写onCreate方法,如下所示:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(getArguments() != null) {
_names= getArguments().getString("names");
_reg= getArguments().getString("reg");
}
}
然后在OnCrateView方法中设置如下所示的文本:
profileNames.setText(_names);
ProfileRegNumber.setText(_reg);
在activity创造出这样的碎片。
private void replaceFragmentInternal(Fragment fragment) {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.setCustomAnimations(R.anim.enter_fragment, R.anim.exit_fragment);
fragmentManager.popBackStack();
fragmentTransaction
.addToBackStack(null)
.replace(R.id.frameLayoutHolder, fragment)
.commit();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
replaceFragmentInternal(ProfileFragment.NewInstance(names,reg));
}
这是我得到的错误:
LOAD DATA INFILE'/home/cloudera/desktople/sql DATA/customer.csv'替换到表Customers字段以‘结尾,行以'\n'结尾;
java.lang.IllegalStateException:未能加载ApplicationContext 原因:org . spring framework . beans . factory . unsatisfieddependencyexception:创建在URL[jar:file:/C:/Users/MDI vya/. m2/repository/io/spring fox/spri
下面是我上传数据的Json格式,但它显示了错误,即在[source:(PushbackInputStream);line:1,column:2]]2021-05-04 12:57:07.799 WARN 876----[nio-9090-exec-4].W.S.M.S.DefaultHandlerExceptionResolver:Resolved[org.springframework.http
在C:\用户\戴尔\桌面\项目\my-app中创建新的React应用。 安装包。这可能需要几分钟。使用cra模板安装反应、反应-多姆和反应-脚本... NPM ERR!最大调用堆栈大小超过npm ERR!超出最大调用堆栈大小 NPM ERR!此运行的完整日志可以在npm ERR中找到!C:\用户\戴尔\AppData\漫游\npmcache_logs\2020-09-05T07_43_27_276
Im使用okhttp 2.5.0,Im获取一张pic,然后将其转换为base 64格式,然后将其作为post变量发送到服务器,然后将其解码回jpg格式并保存到服务器....当我使用像1兆像素(0.5MB)的小图像时,它可以完美地工作······但是当我增加分辨率时,这个异常发生了...