0

I have a problem with my fragment and onitemclicklistener. When I run the app it shows me a list but when I click on such the app crashes. Can someone see what could be the reason for such to be hapenning?

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
    final View result = inflater.inflate(R.layout.fragment_movie, container, false);
    listView = (ListView) result.findViewById(R.id.list);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent(getActivity(), MovieDetailActivity.class);
            intent.putExtra("MOVIE_DETAILS", (MovieDetails) parent.getItemAtPosition(position));
            startActivity(intent);

        }
    });

}

Process: com.vjezba.androidtab.tabswitch, PID: 10943 android.content.ActivityNotFoundException: Unable to find explicit activity class {com.vjezba.androidtab.tabswitch/com.vjezba.androidtab.tabswitch.MovieDetailActivity}; have you declared this activity in your AndroidManifest.xml?

daedsidog
  • 1,732
  • 2
  • 17
  • 36
ceha5
  • 9
  • 4
  • 3
    can you paste your `logcat` Error. – Ali Dec 04 '18 at 10:41
  • Process: com.vjezba.androidtab.tabswitch, PID: 10943 android.content.ActivityNotFoundException: Unable to find explicit activity class {com.vjezba.androidtab.tabswitch/com.vjezba.androidtab.tabswitch.MovieDetailActivity}; have you declared this activity in your AndroidManifest.xml? – ceha5 Dec 04 '18 at 10:45
  • I see now there is a problem with the AndroidManifest, can you tell me what exactly to add in the android manifest file ? thank you so much – ceha5 Dec 04 '18 at 10:45
  • 1
    please declare this activity in `Manifest` file **`MovieDetailActivity`** – Ali Dec 04 '18 at 10:46
  • add it within the `application` tag. You will see other activities there as well. Its better to make new activities by file->new->new activity. Its is added automatically. – Pemba Tamang Dec 04 '18 at 10:50
  • thank you so much for your help :))))) – ceha5 Dec 04 '18 at 10:53

1 Answers1

0

Please add this in your Android Manifest inside application tag:

        <activity
            android:name="com.vjezba.androidtab.tabswitch.MovieDetailActivity" />
Prashanth Verma
  • 588
  • 3
  • 11