Android Toast equivalent in iOS

Bil Kimes picture Bil Kimes · Jul 22, 2014 · Viewed 50.1k times · Source

Does anyone know what the Java Toast equivalent of this iOS Objective C event would be in a Fragment? Below is a sample of what I have written in iOS. What I am looking for the same Alert in Java using a Toast in place of the iOS UIAlert. I am sorry if I did not make that clear on my original post.

- (void) dateLogic {
    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
    [dateFormat setDateFormat:@"MMMM dd"];
    NSString *theDate = [dateFormat stringFromDate:[NSDate date]];

    //JANUARY
    if ([theDate isEqualToString:@"January 01"]) {

        feastDay = [[UIAlertView alloc]
                     initWithTitle:@"New Years Day!"
                     message:@"January 01"
                     delegate:self
                     cancelButtonTitle:nil
                     otherButtonTitles:@"Close", nil];
        feastDay.delegate = self;
        [feastDay show];
    }
}

Answer

Lucia Belardinelli picture Lucia Belardinelli · Feb 6, 2015

I found this amazing class in github that works like a charm. Toast for iOS It is enough to import the UIView+Toast.h and UIView+Toast.m files and then add

[self.view makeToast:@"This is a piece of toast."];

as written in the page examples.