1

I want to open dialog from BroadcastReceiver but it gives an error.

Here is my code:

final Dialog mydata= new Dialog(context);
    mydata.getWindow().setFlags(
            WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
            WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
    mydata.setTitle("   Library Information ");
    LayoutInflater li = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View dialogView = li.inflate(R.layout.singup, null);
    mydata.setContentView(dialogView);
    mydata.show();

java.lang.RuntimeException: Unable to start receiver com.om.dave.MyBroadcastReceiver: android.content.res.Resources$NotFoundException: Resource ID #0x7f030001

How do I open dialog Broadcastreceiver?

Tim Post
  • 33,371
  • 15
  • 110
  • 174
user607589
  • 11
  • 2

2 Answers2

0

Can't be done, although you can make an Activity that looks like a dialog. See Android Broadcast Receiver showing a dialog?

Of course, like CommonsWare implies in the above link, you probably shouldn't start the Activity in the broadcast receiver... it's more user friendly to use a Notification.

Community
  • 1
  • 1
aleph_null
  • 5,766
  • 2
  • 24
  • 39
-3

Open your R.java in your gen folder. Find out the image name for which 0x7f030001 points to.

Find if that image is found in drawable. If not add it.

Also, you clean and build the project completely.

Vinay
  • 2,395
  • 3
  • 30
  • 35
  • Looks like people are only looking at the Question being asked and not the error mentioned in the code. I feel that if the user addresses and fixes the bug, opening a dialog should not be difficult. – Vinay Nov 04 '11 at 06:40