Obviously, I am new to Android - XML programming... So I have a navigation drawer, and once item is selected from the drawer, a corresponding fragment on the right side will display. Inside that fragment, I have linear layouts. I'd like to get redirected to another activity once that linear layout has been tapped. I was able to make it work on activities, by using android:onClick on XML file, but can't make it work on fragment. Somebody help me please.
App interface, refer to this image:
https://i.stack.imgur.com/u6dHi.jpg
Code:
fragment_smart.xml - the display once item's selected. I am trying to use the onClick on xml.
<LinearLayout
    android:id="@+id/linearLayoutsmart1"
    android:layout_width="match_parent"
    android:layout_height="30dp"
    android:layout_below="@+id/smart_title"
    android:layout_marginLeft="15dp"
    android:layout_marginTop="15dp"
    android:orientation="horizontal"
    android:weightSum="1"
    android:onClick="smart_recommended_link">
Here's my Java code:
public class FragmentSmart extends Fragment {
public static final String TAG = "stats";
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View myfragment = inflater.inflate(R.layout.fragment_smart, container, false);
    return myfragment;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
}
public void smart_recommended_link(View view) {
    Intent smartRecommendedIntent = new Intent(this, SmartRecommended.class);
    startActivity(smartRecommendedIntent);
}
}
The app is crashing when I clicked on the linearlayout using this code. What's the best thing to do here? Thank you!
 
     
     
     
     
    