I cant figure how to get a Bundled Key to the conditional method &/the Toast message below.
Any help will be greatly appreciated for my learning experience. Thnx.
public class ListViewFragment extends ListFragment implements OnItemClickListener {
private final String KEY_ADPTR_ID = "KEY_ADPTR_ID";
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState):
Bundle args = this.getArguments();
args.getString(KEY_ADPTR_ID);
. . .
}
. . .
private void showData(String json) throws JSONException {
String adptrID = this.getBundle(KEY_ADPTR_ID);//<-HOW DO I ACCOMPLISH THIS CORRECTLY!!??
Toast.makeText(getActivity(), adptrID, Toast.LENGTH_SHORT).show();
if (adptrID == "3") {
. . .
}
}
What you’ve written in onActivityCreated is correct if you’re passing the KEY_ADPTR_ID in the fragment’s arguments