Issues in Recyclrview Adapter with Fragments

When I try to click on list of items on First Fragments list it will not go to another fragment. Can anyone solve this issue?

@Override public void onBindViewHolder(ExampleAdapter.ViewHolders holder, final int position) {      holder.moviename.setText(text[position]);     holder.date.setText(text1[position]);      holder.layout.setOnClickListener(new View.OnClickListener() {         @Override         public void onClick(View v) {                 android.support.v4.app.Fragment castFragment = new CastFragment();             android.support.v4.app.FragmentManager fragmentManager =((FragmentActivity)context).getSupportFragmentManager();             FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();             fragmentTransaction.replace(R.id.linear,castFragment);             fragmentTransaction.commit();         }     }); 

logactr erros:

FATAL EXCEPTION: main                                                           Process:    ctel.animation, PID: 3168                                                           java.lang.NullPointerException: Attempt to invoke virtual method 'android.support.v4.app.FragmentManager android.support.v4.app.FragmentActivity.getSupportFragmentManager()' on a null object reference                                                               at ctel.animation.ExampleAdapter$1.onClick(ExampleAdapter.java:48)                                                               at android.view.View.performClick(View.java:5198)                                                               at android.view.View$PerformClick.run(View.java:21147)                                                               at android.os.Handler.handleCallback(Handler.java:739)                                                               at android.os.Handler.dispatchMessage(Handler.java:95)                                                               at android.os.Looper.loop(Looper.java:148)                                                               at android.app.ActivityThread.main(ActivityThread.java:5417)                                                               at java.lang.reflect.Method.invoke(Native Method)                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

Replay

Category: android Time: 2016-07-31 Views: 3

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.125 (s). 12 q(s)