I have an activity that adds a die in JsonObjetct. And as seen in the following code, I take it as string, but, my doubt, how do I by this JsonObject in the fragment so I can work with it, as Json?
Follow the Activity code:
.........
objectJson = SharedPreferenceHelper.getScheduling(this);
inicializeSetting(savedInstanceState);
btn_1 = (ToggleButton)findViewById(R.id.tglSearch1);
btn_1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
btn_1.setChecked(true);
btn_2.setChecked(false);
objectJson.addProperty("type", 0);
}
});
btn_2 = (ToggleButton)findViewById(R.id.tglSearch2);
btn_2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
btn_1.setChecked(false);
btn_2.setChecked(true);
objectJson.addProperty("type", 1);
}
});
btnContinuar = (Button)findViewById(R.id.btnGoSearch);
btnContinuar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SearchAskListFragment fragment = new SearchAskListFragment();
Bundle bundle = new Bundle();
bundle.putString("json", objectJson.toString());
fragment.setArguments(bundle);
getSupportFragmentManager().beginTransaction()
.add(R.id.containerLinear, fragment)
.commit();
getSupportFragmentManager().executePendingTransactions();
// Routes.open(getApplicationContext(),URIs.SearchAskFragment());
}
});