G
G
goodTimes2017-03-03 14:05:42
Java
goodTimes, 2017-03-03 14:05:42

When calling another fragment from a fragment, the program crashes, why?

Through Navigation draw I load the list into the fragment, I want to select an element from this list and display its full description in the fragment

listView = (ListView) view.findViewById(R.id.TeoryList);
ArrayAdapter adapter = new ArrayAdapter(view.getContext(), android.R.layout.simple_list_item_1, informations);
listView.setAdapter(adapter);
listView.setClickable(true);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
fdiscription = new FragmentDiscription();
FragmentTransaction ftrans = getFragmentManager().beginTransaction();
ftrans.replace(R.id.content_main, fdiscription);
ftrans.commit();
}

Help a newbie guru

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question