Click here to Skip to main content
15,844,387 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In an activity, on click of a button I raise a fragment. This fragment also has button inside it. Now on click of this fragment button 'onCancelClick', I want to startActivity
named as 'Titles.class'. There is no error in the code but I get the message that 'apps has stopped working'.
public class titles_new_fragment extends Fragment {
    public View onCreateView( LayoutInflater inflator, ViewGroup container,Bundle  savedInstanceState) {
      return inflator.inflate(R.layout.fragment_titles_new_layout,container,false);

    private void onCancelClick(View v)
      Intent intent = new Intent( getActivity(), Titles.class);
Updated 15-Mar-15 1:10am
Is it going through a infinite loop or something? Have you debugged?
S.Rajendran from Coimbatore 15-Mar-15 6:12am    
No it is not going in the loop.
Then debug and see on which line exactly it is stopping?
Aditya_Goud 17-Mar-15 3:02am    
Debugg ans then say where(which line) u r getting that ..
Sandeep Londhe 17-Mar-15 15:03pm    
post the logcat

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900