Share Content With UIActivityViewController

Share text @IBAction func shareText(_ sender: UIButton) { let text = “Your text” let textShare = [ text ] let activityVC = UIActivityViewController(activityItems: textShare , applicationActivities: nil) activityVC.popoverPresentationController?.sourceView = self.view self.present(activityVC, animated: true, completion: nil) } Share image @IBAction func shareImage(_ sender: UIButton) { let image = UIImage(named: “Image”) let Read more…

Bài 1: Tạo ứng dụng react native đầu tiên và cho chạy trên thiết bị iOS và Android

Chào các bạn, đây là bài đầu tiên trong loạt bài về react native Ờ biết rồi vô cứ việc làm theo từng bước là auto được Bước 0: Cài mấy thứ linh tinh như: Homebrew, Node.js, Watchman /usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” brew install node brew install watchman Nếu chưa Read more…

Email validation method – Android Kotlin

Here we will use regular expression (regex) to validate email address using Kotlin programming language. class EmailValidator { companion object { fun isEmailValid(email: String): Boolean { return Patterns.EMAIL_ADDRESS.toRegex().matches(email); } } } or fun String.isValidEmail(): Boolean = this.isNotEmpty() && Patterns.EMAIL_ADDRESS.matcher(this).matches() Please feel free to comment if you have newer techniques as Read more…

How to create content sliding using ViewPager in Kotlin

Make a content slider, modification from ViewPager with Kotlin programming language. Step 1. Add view pager into your layout activity_main.xml <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent”> <android.support.v4.view.ViewPager android:id=”@+id/viewPager” android:layout_width=”match_parent” android:layout_height=”match_parent” /> </RelativeLayout> Step 2. Create your fragment and its layout: fragment_viewpager_item.xml <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:id=”@+id/rootView” android:layout_width=”match_parent” android:layout_height=”match_parent” Read more…