i having a value transfered from another fragment to this fragment(mentioned below) and the data is transfered successfully but i when tried to get the data through the bundle it generates an error, and i tried but can't resolve it
help me, Thank you!
Fragment code:
public class BusinessDetail extends Fragment {
String value1;
Bundle bundle;
private TextView headlineSecond;
private TextView authorSecond;
private TextView detailsSecond;
private List<StringList> s;
public BusinessDetail() {
}
public void receiveValue(StringList value, int positionValue) {
bundle = new Bundle();
bundle.putString("news", value.authorName);
BusinessDetail detail = new BusinessDetail();
detail.setArguments(bundle);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_business_detail, container, false);
headlineSecond = (TextView) view.findViewById(R.id.id_headline_second);
authorSecond = (TextView) view.findViewById(R.id.id_author_second);
detailsSecond = (TextView) view.findViewById(R.id.id_details_second);
value1 = getArguments().getString("news");
authorSecond.setText(value1);
return view;
}}
Error:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.Bundle.getString(java.lang.String)' on a null object reference
at com.bulletin.theinvincible.bulletin.BusinessDetail.onCreateView(BusinessDetail.java:50)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2184)