0

now am getting nullpointerException when building the callBack Interface in between fragments. Please suggest solution to overcome this issue. Thank you in advance.

Sarath VK
  • 29
  • 3
  • please share your code – Linh Jul 28 '16 at 07:39
  • 1
    share your sample code. – Muthu Jul 28 '16 at 07:39
  • http://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it – adalpari Jul 28 '16 at 07:40
  • OnHeadlineSelectedListener mCallback; public interface OnHeadlineSelectedListener { public void onArticleSelected(int position); } – Sarath VK Jul 28 '16 at 07:53
  • if you don't show all the code you are ussing for the callback, I'm affraid that we can not help you.. – adalpari Jul 28 '16 at 07:57
  • @Override public void onAttach(Context context) { super.onAttach(context); try { mCallback = (OnHeadlineSelectedListener) context; } catch (ClassCastException e) {throw new ClassCastException(context.toString() + " must implement OnHeadlineSelectedListener"); } } – Sarath VK Jul 28 '16 at 07:57
  • Actually , am new to callback , have no exact idea how to use – Sarath VK Jul 28 '16 at 07:58
  • @SarathVK this is not the way to ask a question. Put your code, formatted, in main ask, not in comments. http://stackoverflow.com/help/how-to-ask – adalpari Jul 28 '16 at 07:59
  • if you have any idea, please share with me about callback – Sarath VK Jul 28 '16 at 08:05

0 Answers0