Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Toast equivalent in iOS

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];     } } 
like image 987
Bil Kimes Avatar asked Jul 22 '14 17:07

Bil Kimes


People also ask

What is equivalent of Toast in iOS?

A toast message in iOS is a small, short-lived popup that provides a small bite of information to the users. In this iOS Swift tutorial, we will learn how to implement an iOS toast message in your iPhone app, but we will also show how to add animation to that.

Does Toast Android work on iOS?

Toasts are a native feature of Android, but iOS doesn't have this by default. If you only need toasts on Android, you can use the ToastAndroid API provided by React Native.

What is the Toast in Android?

A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive. Toasts automatically disappear after a timeout.


1 Answers

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.

like image 150
Lucia Belardinelli Avatar answered Oct 14 '22 09:10

Lucia Belardinelli