コード例 #1
0
 private void logEventAction() {
   UIAlertView alert =
       new UIAlertView(
           "Log Event",
           "Select an event to send:",
           new UIAlertViewDelegateAdapter() {
             @Override
             public void clicked(UIAlertView alertView, long buttonIndex) {
               switch ((int) buttonIndex) {
                 case 1:
                   Flurry.logEvent("Event_A");
                   break;
                 case 2:
                   Flurry.logEvent("Event_B");
                   break;
                 default:
                   break;
               }
             }
           },
           "Cancel",
           "Event A",
           "Event B");
   alert.show();
 }
コード例 #2
0
  private void setUserAge() {
    UIAlertView alert =
        new UIAlertView(
            "Set User Age",
            "",
            new UIAlertViewDelegateAdapter() {
              @Override
              public void clicked(UIAlertView alertView, long buttonIndex) {
                if (buttonIndex == 1) {
                  UITextField textField = alertView.getTextField(0);
                  if (textField.getText() != null && !textField.getText().isEmpty()) {
                    int age = Integer.valueOf(textField.getText());
                    Flurry.setAge(age);
                  }

                  setUserGender();
                }
              }
            },
            "Cancel",
            "OK");
    alert.setAlertViewStyle(UIAlertViewStyle.PlainTextInput);
    alert.getTextField(0).setKeyboardType(UIKeyboardType.NumberPad);
    alert.show();
  }
コード例 #3
0
 private void logTimedEventAction() {
   UIAlertView alert =
       new UIAlertView(
           "Log Timed Event",
           "Press OK to start the timed event.",
           new UIAlertViewDelegateAdapter() {
             @Override
             public void clicked(UIAlertView alertView, long buttonIndex) {
               final String eventName = "Event_Timed";
               if (buttonIndex == 1) {
                 Flurry.logEvent(eventName, true);
                 UIAlertView stopAlert =
                     new UIAlertView(
                         "Stop Timed Event",
                         "Press OK to stop the timed event.",
                         new UIAlertViewDelegateAdapter() {
                           @Override
                           public void willDismiss(UIAlertView alertView, long buttonIndex) {
                             Flurry.endTimedEvent(eventName);
                           }
                         },
                         "OK");
                 stopAlert.show();
               }
             }
           },
           "Cancel",
           "OK");
   alert.show();
 }
コード例 #4
0
 private void logEventWithParametersAction() {
   UIAlertView alert =
       new UIAlertView(
           "Log Event with Parameters",
           "Select parameters:",
           new UIAlertViewDelegateAdapter() {
             @Override
             public void clicked(UIAlertView alertView, long buttonIndex) {
               final String eventName = "Event_with_Parameters";
               switch ((int) buttonIndex) {
                 case 1:
                   Map<String, String> params1 = new HashMap<>();
                   params1.put("Param1", String.valueOf(101));
                   Flurry.logEvent(eventName, params1);
                   break;
                 case 2:
                   NSDictionary<?, ?> params2 = new NSMutableDictionary<>();
                   params2.put("Param1", "Test");
                   params2.put("Param2", 202);
                   Flurry.logEvent(eventName, params2);
                   break;
                 default:
                   break;
               }
             }
           },
           "Cancel",
           "Param1 = 101",
           "Param1 = Test, Param2 = 202");
   alert.show();
 }
コード例 #5
0
  @IBAction
  private void didTapShare(UIBarButtonItem sender) {
    GAITracker tracker = GAI.getSharedInstance().getDefaultTracker();
    NSMutableDictionary<?, ?> event =
        GAIDictionaryBuilder.createEvent("Action", "Share", null, null).build();
    tracker.send(event);

    String title = String.format("Share: %s", getSelectedViewController().getTitle());
    String message = "Share is not implemented in this quickstart";
    UIAlertView alert = new UIAlertView(title, message, null, "OK");
    alert.show();
  }
コード例 #6
0
 private void setUserGender() {
   UIAlertView alert =
       new UIAlertView(
           "Set User Gender",
           "",
           new UIAlertViewDelegateAdapter() {
             @Override
             public void clicked(UIAlertView alertView, long buttonIndex) {
               if (buttonIndex == 1) {
                 Flurry.setGender("m");
               } else if (buttonIndex == 2) {
                 Flurry.setGender("f");
               }
             }
           },
           "Cancel",
           "Male",
           "Female");
   alert.show();
 }
コード例 #7
0
 private void logErrorAction() {
   UIAlertView alert =
       new UIAlertView(
           "Log Error",
           "Press OK to log an exception.",
           new UIAlertViewDelegateAdapter() {
             @Override
             public void clicked(UIAlertView alertView, long buttonIndex) {
               if (buttonIndex == 1) {
                 try {
                   // Let's produce some silly error.
                   Integer.valueOf("Error");
                 } catch (NumberFormatException e) {
                   Flurry.logError(e);
                 }
               }
             }
           },
           "Cancel",
           "OK");
   alert.show();
 }
コード例 #8
0
  private void setUserID() {
    UIAlertView alert =
        new UIAlertView(
            "Set User ID",
            "",
            new UIAlertViewDelegateAdapter() {
              @Override
              public void clicked(UIAlertView alertView, long buttonIndex) {
                if (buttonIndex == 1) {
                  UITextField textField = alertView.getTextField(0);
                  if (textField.getText() != null && !textField.getText().isEmpty()) {
                    String userID = textField.getText();
                    Flurry.setUserID(userID);
                  }

                  setUserAge();
                }
              }
            },
            "Cancel",
            "OK");
    alert.setAlertViewStyle(UIAlertViewStyle.PlainTextInput);
    alert.show();
  }