Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.58 KB | None | 0 0
  1. 04-29 01:01:20.973: WARN/dalvikvm(1168): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
  2. 04-29 01:01:20.973: ERROR/AndroidRuntime(1168): Uncaught handler: thread main exiting due to uncaught exception
  3. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): java.lang.IllegalArgumentException: Activity#onCreateDialog did not create a dialog for id 4
  4. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.app.Activity.createDialog(Activity.java:871)
  5. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.app.Activity.showDialog(Activity.java:2483)
  6. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at mjb.project.AVV.Favs.onMenuItemSelected(Favs.java:111)
  7. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:730)
  8. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:139)
  9. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
  10. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:525)
  11. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
  12. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.view.View.onTouchEvent(View.java:4179)
  13. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.widget.TextView.onTouchEvent(TextView.java:6540)
  14. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.view.View.dispatchTouchEvent(View.java:3709)
  15. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
  16. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
  17. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
  18. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
  19. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.os.Handler.dispatchMessage(Handler.java:99)
  20. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.os.Looper.loop(Looper.java:123)
  21. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at android.app.ActivityThread.main(ActivityThread.java:4363)
  22. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at java.lang.reflect.Method.invokeNative(Native Method)
  23. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at java.lang.reflect.Method.invoke(Method.java:521)
  24. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
  25. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  26. 04-29 01:01:20.993: ERROR/AndroidRuntime(1168): at dalvik.system.NativeStart.main(Native Method)
  27.  
  28. private static final int DELETE_DB_ID = 3;
  29. private Dialog dialog;
  30. static final int DIALOG_DELETEDB = 4;
  31.  
  32. protected Dialog onCreateDialog(int id) {
  33. switch(id) {
  34. case DIALOG_DELETEDB:
  35. // do the work to define the pause Dialog
  36. AlertDialog.Builder builder = new AlertDialog.Builder(this);
  37. builder.setMessage("Are you sure you want to exit?")
  38. .setCancelable(false)
  39. .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
  40. public void onClick(DialogInterface dialog, int id) {
  41. Favs.this.finish();
  42. }
  43. })
  44. .setNegativeButton("No", new DialogInterface.OnClickListener() {
  45. public void onClick(DialogInterface dialog, int id) {
  46. dialog.cancel();
  47. }
  48. });
  49. AlertDialog alert = builder.create();
  50. alert.show();
  51. break;
  52. default:
  53. dialog = null;
  54. }
  55.  
  56.  
  57. return dialog;
  58. }
  59.  
  60. @Override
  61. public boolean onMenuItemSelected(int featureId, MenuItem item) {
  62. switch(item.getItemId()) {
  63. case ADD_ID:
  64. createNote();
  65. return true;
  66. case DELETE_DB_ID:
  67. showDialog(DIALOG_DELETEDB);
  68. return true;
  69. }
  70. return super.onMenuItemSelected(featureId, item);
  71. }
  72.  
  73. protected Dialog onCreateDialog(int id) {
  74. switch(id) {
  75. case DIALOG_DELETEDB:
  76. // do the work to define the pause Dialog
  77. AlertDialog.Builder builder = new AlertDialog.Builder(this);
  78. builder.setMessage("Are you sure you want to exit?")
  79. .setCancelable(false)
  80. .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
  81. public void onClick(DialogInterface dialog, int id) {
  82. Favs.this.finish();
  83. }
  84. })
  85. .setNegativeButton("No", new DialogInterface.OnClickListener() {
  86. public void onClick(DialogInterface dialog, int id) {
  87. dialog.cancel();
  88. }
  89. });
  90. AlertDialog alert = builder.create();
  91. return alert;
  92. }
  93.  
  94. return null;
  95. }
  96.  
  97. public boolean onMenuItemSelected(int featureId, MenuItem item) {
  98. switch(item.getItemId()) {
  99. case DELETE_DB_ID:
  100. AlertDialog.Builder builder = new AlertDialog.Builder(this);
  101. builder.setMessage("Are you sure you want to exit?")
  102. .setCancelable(false)
  103. .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
  104. public void onClick(DialogInterface dialog, int id) {
  105. Favs.this.finish();
  106. }
  107. })
  108. .setNegativeButton("No", new DialogInterface.OnClickListener() {
  109. public void onClick(DialogInterface dialog, int id) {
  110. dialog.cancel();
  111. }
  112. });
  113. AlertDialog alert = builder.create();
  114. alert.show();
  115. return true;
  116. }
  117. return super.onMenuItemSelected(featureId, item);
  118. }
  119.  
  120. AlertDialog alert = new AlertDialog.Builder(this).create();
  121. alert.setTitle("Error");
  122. alert.setMessage("Sorry, your device doesn't support flash light!");
  123. alert.setButton(Dialog.BUTTON_POSITIVE,"OK",new DialogInterface.OnClickListener(){
  124.  
  125. @Override
  126. public void onClick(DialogInterface dialog, int which) {
  127. finish();
  128. }
  129. });
  130.  
  131. alert.show();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement