0

In a class which extends fragment... I have to show dialog I am using this code but my application stops can any one help me..

c = getActivity();
Dialog dia = new Dialog(c);
dia.setTitle("No Internet Access");
TextView tvw = (TextView) dia.findViewById(R.id.tv_test);
tvw.setText("connect to the internet");
dia.setContentView(tvw);
dia.show();
Naveed Ali
  • 2,609
  • 1
  • 22
  • 37

2 Answers2

0

You should use DialogFragments.

Check this out.

If you don't want to go into DialogFragments, you can just build a simple dialog. For that check this answer.

Community
  • 1
  • 1
Mikel
  • 1,581
  • 17
  • 35
0

I got my error, I was passing wrong id to the TextView()

Naveed Ali
  • 2,609
  • 1
  • 22
  • 37