App crashes when I use click listener on button in fragment



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have used ViewPager in MainActivity, which extends AppCompatActivity. When I remove setOnClickListener it doesn't crash but when I set click listener it crashes with given log.



Here is the log but still I don't understand why its happening



 --------- beginning of crash
2018-11-15 20:26:51.814 1654-1654/com.example.suraj.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.suraj.myapplication, PID: 1654
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
at android.widget.Toast.<init>(Toast.java:104)
at android.widget.Toast.makeText(Toast.java:262)
at com.example.suraj.myapplication.ThirdFragment.onClick(ThirdFragment.java:56)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)


I tried many times but still It's not working. My fragment code is as



package com.example.sdgh.myapplication;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

import com.squareup.picasso.Picasso;

public class ThirdFragment extends Fragment implements View.OnClickListener
ImageView ig3;
View view;
Context mContext;
Button b;

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
/* ViewGroup rootview3 = (ViewGroup)inflater.inflate(R.layout.third_frag,container,false);
ImageView ig3 = (ImageView)rootview3.findViewById(R.id.thirdimage);
// Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(ig3);
container.addView(rootview3);

return rootview3;*/

view = inflater.inflate(R.layout.third_frag,container,false);
ig3 = (ImageView)view.findViewById(R.id.thirdimage);
b = (Button)view.findViewById(R.id.thirdbutton);
Picasso.get().load("https://cloudinary.com/images//da2fd17643796658bb733d1c848454590aa303cd/developeour-list.png").into(ig3);
b.setOnClickListener(this);
container.addView(view);

return view;


@Override
public void onClick(View v)
switch (v.getId())
case R.id.thirdbutton:
Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show();
break;

//Toast.makeText(mContext,"Onclicked",Toast.LENGTH_SHORT).show();


public static ThirdFragment newInstance(String text)
ThirdFragment f = new ThirdFragment();
Bundle b = new Bundle();
b.putString("msg", text);
f.setArguments(b);
return f;











share|improve this question
























  • You are using 'mContext' but you are never initializing it. It's dropping the Nullpointer cause it is searching for a Context that currenly is Null.

    – Beasteca
    Nov 15 '18 at 15:14











  • Where are you initiating the mContext variable?

    – Blogger
    Nov 15 '18 at 15:15











  • Even if I remove Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show(); still it crashes

    – doja
    Nov 15 '18 at 15:18











  • Is it the same error log or a different one when you remove the Toast line?

    – Blogger
    Nov 15 '18 at 15:19











  • it will be different one. do you want me to post new logs here ?

    – doja
    Nov 15 '18 at 15:20


















0















I have used ViewPager in MainActivity, which extends AppCompatActivity. When I remove setOnClickListener it doesn't crash but when I set click listener it crashes with given log.



Here is the log but still I don't understand why its happening



 --------- beginning of crash
2018-11-15 20:26:51.814 1654-1654/com.example.suraj.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.suraj.myapplication, PID: 1654
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
at android.widget.Toast.<init>(Toast.java:104)
at android.widget.Toast.makeText(Toast.java:262)
at com.example.suraj.myapplication.ThirdFragment.onClick(ThirdFragment.java:56)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)


I tried many times but still It's not working. My fragment code is as



package com.example.sdgh.myapplication;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

import com.squareup.picasso.Picasso;

public class ThirdFragment extends Fragment implements View.OnClickListener
ImageView ig3;
View view;
Context mContext;
Button b;

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
/* ViewGroup rootview3 = (ViewGroup)inflater.inflate(R.layout.third_frag,container,false);
ImageView ig3 = (ImageView)rootview3.findViewById(R.id.thirdimage);
// Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(ig3);
container.addView(rootview3);

return rootview3;*/

view = inflater.inflate(R.layout.third_frag,container,false);
ig3 = (ImageView)view.findViewById(R.id.thirdimage);
b = (Button)view.findViewById(R.id.thirdbutton);
Picasso.get().load("https://cloudinary.com/images//da2fd17643796658bb733d1c848454590aa303cd/developeour-list.png").into(ig3);
b.setOnClickListener(this);
container.addView(view);

return view;


@Override
public void onClick(View v)
switch (v.getId())
case R.id.thirdbutton:
Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show();
break;

//Toast.makeText(mContext,"Onclicked",Toast.LENGTH_SHORT).show();


public static ThirdFragment newInstance(String text)
ThirdFragment f = new ThirdFragment();
Bundle b = new Bundle();
b.putString("msg", text);
f.setArguments(b);
return f;











share|improve this question
























  • You are using 'mContext' but you are never initializing it. It's dropping the Nullpointer cause it is searching for a Context that currenly is Null.

    – Beasteca
    Nov 15 '18 at 15:14











  • Where are you initiating the mContext variable?

    – Blogger
    Nov 15 '18 at 15:15











  • Even if I remove Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show(); still it crashes

    – doja
    Nov 15 '18 at 15:18











  • Is it the same error log or a different one when you remove the Toast line?

    – Blogger
    Nov 15 '18 at 15:19











  • it will be different one. do you want me to post new logs here ?

    – doja
    Nov 15 '18 at 15:20














0












0








0








I have used ViewPager in MainActivity, which extends AppCompatActivity. When I remove setOnClickListener it doesn't crash but when I set click listener it crashes with given log.



Here is the log but still I don't understand why its happening



 --------- beginning of crash
2018-11-15 20:26:51.814 1654-1654/com.example.suraj.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.suraj.myapplication, PID: 1654
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
at android.widget.Toast.<init>(Toast.java:104)
at android.widget.Toast.makeText(Toast.java:262)
at com.example.suraj.myapplication.ThirdFragment.onClick(ThirdFragment.java:56)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)


I tried many times but still It's not working. My fragment code is as



package com.example.sdgh.myapplication;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

import com.squareup.picasso.Picasso;

public class ThirdFragment extends Fragment implements View.OnClickListener
ImageView ig3;
View view;
Context mContext;
Button b;

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
/* ViewGroup rootview3 = (ViewGroup)inflater.inflate(R.layout.third_frag,container,false);
ImageView ig3 = (ImageView)rootview3.findViewById(R.id.thirdimage);
// Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(ig3);
container.addView(rootview3);

return rootview3;*/

view = inflater.inflate(R.layout.third_frag,container,false);
ig3 = (ImageView)view.findViewById(R.id.thirdimage);
b = (Button)view.findViewById(R.id.thirdbutton);
Picasso.get().load("https://cloudinary.com/images//da2fd17643796658bb733d1c848454590aa303cd/developeour-list.png").into(ig3);
b.setOnClickListener(this);
container.addView(view);

return view;


@Override
public void onClick(View v)
switch (v.getId())
case R.id.thirdbutton:
Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show();
break;

//Toast.makeText(mContext,"Onclicked",Toast.LENGTH_SHORT).show();


public static ThirdFragment newInstance(String text)
ThirdFragment f = new ThirdFragment();
Bundle b = new Bundle();
b.putString("msg", text);
f.setArguments(b);
return f;











share|improve this question
















I have used ViewPager in MainActivity, which extends AppCompatActivity. When I remove setOnClickListener it doesn't crash but when I set click listener it crashes with given log.



Here is the log but still I don't understand why its happening



 --------- beginning of crash
2018-11-15 20:26:51.814 1654-1654/com.example.suraj.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.suraj.myapplication, PID: 1654
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
at android.widget.Toast.<init>(Toast.java:104)
at android.widget.Toast.makeText(Toast.java:262)
at com.example.suraj.myapplication.ThirdFragment.onClick(ThirdFragment.java:56)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)


I tried many times but still It's not working. My fragment code is as



package com.example.sdgh.myapplication;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

import com.squareup.picasso.Picasso;

public class ThirdFragment extends Fragment implements View.OnClickListener
ImageView ig3;
View view;
Context mContext;
Button b;

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
/* ViewGroup rootview3 = (ViewGroup)inflater.inflate(R.layout.third_frag,container,false);
ImageView ig3 = (ImageView)rootview3.findViewById(R.id.thirdimage);
// Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(ig3);
container.addView(rootview3);

return rootview3;*/

view = inflater.inflate(R.layout.third_frag,container,false);
ig3 = (ImageView)view.findViewById(R.id.thirdimage);
b = (Button)view.findViewById(R.id.thirdbutton);
Picasso.get().load("https://cloudinary.com/images//da2fd17643796658bb733d1c848454590aa303cd/developeour-list.png").into(ig3);
b.setOnClickListener(this);
container.addView(view);

return view;


@Override
public void onClick(View v)
switch (v.getId())
case R.id.thirdbutton:
Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show();
break;

//Toast.makeText(mContext,"Onclicked",Toast.LENGTH_SHORT).show();


public static ThirdFragment newInstance(String text)
ThirdFragment f = new ThirdFragment();
Bundle b = new Bundle();
b.putString("msg", text);
f.setArguments(b);
return f;








android android-fragments android-viewpager






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 15:47









Sergey Glotov

17k117290




17k117290










asked Nov 15 '18 at 15:08









dojadoja

1




1












  • You are using 'mContext' but you are never initializing it. It's dropping the Nullpointer cause it is searching for a Context that currenly is Null.

    – Beasteca
    Nov 15 '18 at 15:14











  • Where are you initiating the mContext variable?

    – Blogger
    Nov 15 '18 at 15:15











  • Even if I remove Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show(); still it crashes

    – doja
    Nov 15 '18 at 15:18











  • Is it the same error log or a different one when you remove the Toast line?

    – Blogger
    Nov 15 '18 at 15:19











  • it will be different one. do you want me to post new logs here ?

    – doja
    Nov 15 '18 at 15:20


















  • You are using 'mContext' but you are never initializing it. It's dropping the Nullpointer cause it is searching for a Context that currenly is Null.

    – Beasteca
    Nov 15 '18 at 15:14











  • Where are you initiating the mContext variable?

    – Blogger
    Nov 15 '18 at 15:15











  • Even if I remove Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show(); still it crashes

    – doja
    Nov 15 '18 at 15:18











  • Is it the same error log or a different one when you remove the Toast line?

    – Blogger
    Nov 15 '18 at 15:19











  • it will be different one. do you want me to post new logs here ?

    – doja
    Nov 15 '18 at 15:20

















You are using 'mContext' but you are never initializing it. It's dropping the Nullpointer cause it is searching for a Context that currenly is Null.

– Beasteca
Nov 15 '18 at 15:14





You are using 'mContext' but you are never initializing it. It's dropping the Nullpointer cause it is searching for a Context that currenly is Null.

– Beasteca
Nov 15 '18 at 15:14













Where are you initiating the mContext variable?

– Blogger
Nov 15 '18 at 15:15





Where are you initiating the mContext variable?

– Blogger
Nov 15 '18 at 15:15













Even if I remove Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show(); still it crashes

– doja
Nov 15 '18 at 15:18





Even if I remove Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show(); still it crashes

– doja
Nov 15 '18 at 15:18













Is it the same error log or a different one when you remove the Toast line?

– Blogger
Nov 15 '18 at 15:19





Is it the same error log or a different one when you remove the Toast line?

– Blogger
Nov 15 '18 at 15:19













it will be different one. do you want me to post new logs here ?

– doja
Nov 15 '18 at 15:20






it will be different one. do you want me to post new logs here ?

– doja
Nov 15 '18 at 15:20













1 Answer
1






active

oldest

votes


















0














You forgot init varible mContext.



Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show();


You can use getContext() or getActivity() like that:



Toast.makeText(getContext(),"Third button clicked",Toast.LENGTH_SHORT).show();


or



Toast.makeText(getActivity(),"Third button clicked",Toast.LENGTH_SHORT).show();





share|improve this answer























  • Inside a fragment, getActivity() is preferred

    – Blogger
    Nov 15 '18 at 15:17











  • Even if I remove Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show(); still it crashes

    – doja
    Nov 15 '18 at 15:17











  • Thanks onix your solution is working I used getAvctivity() and its working fine.

    – doja
    Nov 15 '18 at 15:45











  • Please mark question as answered

    – Onix
    Nov 16 '18 at 8:46











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53322389%2fapp-crashes-when-i-use-click-listener-on-button-in-fragment%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You forgot init varible mContext.



Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show();


You can use getContext() or getActivity() like that:



Toast.makeText(getContext(),"Third button clicked",Toast.LENGTH_SHORT).show();


or



Toast.makeText(getActivity(),"Third button clicked",Toast.LENGTH_SHORT).show();





share|improve this answer























  • Inside a fragment, getActivity() is preferred

    – Blogger
    Nov 15 '18 at 15:17











  • Even if I remove Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show(); still it crashes

    – doja
    Nov 15 '18 at 15:17











  • Thanks onix your solution is working I used getAvctivity() and its working fine.

    – doja
    Nov 15 '18 at 15:45











  • Please mark question as answered

    – Onix
    Nov 16 '18 at 8:46















0














You forgot init varible mContext.



Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show();


You can use getContext() or getActivity() like that:



Toast.makeText(getContext(),"Third button clicked",Toast.LENGTH_SHORT).show();


or



Toast.makeText(getActivity(),"Third button clicked",Toast.LENGTH_SHORT).show();





share|improve this answer























  • Inside a fragment, getActivity() is preferred

    – Blogger
    Nov 15 '18 at 15:17











  • Even if I remove Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show(); still it crashes

    – doja
    Nov 15 '18 at 15:17











  • Thanks onix your solution is working I used getAvctivity() and its working fine.

    – doja
    Nov 15 '18 at 15:45











  • Please mark question as answered

    – Onix
    Nov 16 '18 at 8:46













0












0








0







You forgot init varible mContext.



Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show();


You can use getContext() or getActivity() like that:



Toast.makeText(getContext(),"Third button clicked",Toast.LENGTH_SHORT).show();


or



Toast.makeText(getActivity(),"Third button clicked",Toast.LENGTH_SHORT).show();





share|improve this answer













You forgot init varible mContext.



Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show();


You can use getContext() or getActivity() like that:



Toast.makeText(getContext(),"Third button clicked",Toast.LENGTH_SHORT).show();


or



Toast.makeText(getActivity(),"Third button clicked",Toast.LENGTH_SHORT).show();






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 15 '18 at 15:15









OnixOnix

4559




4559












  • Inside a fragment, getActivity() is preferred

    – Blogger
    Nov 15 '18 at 15:17











  • Even if I remove Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show(); still it crashes

    – doja
    Nov 15 '18 at 15:17











  • Thanks onix your solution is working I used getAvctivity() and its working fine.

    – doja
    Nov 15 '18 at 15:45











  • Please mark question as answered

    – Onix
    Nov 16 '18 at 8:46

















  • Inside a fragment, getActivity() is preferred

    – Blogger
    Nov 15 '18 at 15:17











  • Even if I remove Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show(); still it crashes

    – doja
    Nov 15 '18 at 15:17











  • Thanks onix your solution is working I used getAvctivity() and its working fine.

    – doja
    Nov 15 '18 at 15:45











  • Please mark question as answered

    – Onix
    Nov 16 '18 at 8:46
















Inside a fragment, getActivity() is preferred

– Blogger
Nov 15 '18 at 15:17





Inside a fragment, getActivity() is preferred

– Blogger
Nov 15 '18 at 15:17













Even if I remove Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show(); still it crashes

– doja
Nov 15 '18 at 15:17





Even if I remove Toast.makeText(mContext,"Third button clicked",Toast.LENGTH_SHORT).show(); still it crashes

– doja
Nov 15 '18 at 15:17













Thanks onix your solution is working I used getAvctivity() and its working fine.

– doja
Nov 15 '18 at 15:45





Thanks onix your solution is working I used getAvctivity() and its working fine.

– doja
Nov 15 '18 at 15:45













Please mark question as answered

– Onix
Nov 16 '18 at 8:46





Please mark question as answered

– Onix
Nov 16 '18 at 8:46



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53322389%2fapp-crashes-when-i-use-click-listener-on-button-in-fragment%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo