반응형

출처: https://stackoverflow.com/questions/20261181/nullpointerexception-on-getactivity-fragment


  1. First declare context variable: 
    private Context context;
  2. In onCreateView():
    context = container.getContext();
  3. Use it for Toast:
    Toast.makeText(context, "Your vote was sent", Toast.LENGTH_LONG).show();


반응형

+ Recent posts