您的足迹:首页 > Android >Android Edittext 禁止输入emoji表情

Android Edittext 禁止输入emoji表情


InputFilter[] emojiFilters = { emojiFilter };
edit_nickname.setFilters(emojiFilters);


	private InputFilter emojiFilter = new InputFilter() {

		Pattern emoji = Pattern
				.compile(

						"[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]",

						Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE);

		@Override
		public CharSequence filter(CharSequence source, int start, int end,
				Spanned dest, int dstart,

				int dend) {

			Matcher emojiMatcher = emoji.matcher(source);

			if (emojiMatcher.find()) {

				return "";

			}
			return null;

		}
	};
// 非法字符过滤,涵盖了emoji表情:
private InputFilter filter = new InputFilter() {

		@Override
		public CharSequence filter(CharSequence source, int start, int end,
				Spanned dest, int dstart, int dend) {

			for (int i = start; i < end; i++) {
				if (!Character.isLetterOrDigit(source.charAt(i))
						&& !Character.toString(source.charAt(i)).equals("_")
						&& !Character.toString(source.charAt(i)).equals("-")) {
					return "";
				}
			}

			return null;

		}
	};




本博客所有文章如无特别注明均为原创。作者:AlanWang复制或转载请以超链接形式注明转自 AlanWang的博客-专注android和蓝牙BLE技术分享
原文地址《Android Edittext 禁止输入emoji表情

相关推荐

发表评论

路人甲 表情
看不清楚?点图切换 Ctrl+Enter快速提交

网友评论(2)

- Order Lasix With No Prescription. Tegretol Patient Assistance Neurontin Mild Spring Allergies Varicocele Finasteride Male Nexium Gastric Bypass Acid Reflux . Bonuses in modern drugstores, Order amitriptyline online overnight, Quickest way to get generic medications? Buying legal medications online!  Minocycline Tetracycline Stained Teeth . Methotrexate Vs Prednisone Mg Pre Diabetes Treatment Insulin Resistance  Lisinopril Kidney Disease Medication Red Wine Migraine Beverages Xenical Article Weight Loss Fluconazole Photos  
http://sunniforum.net/showthread.php?p=82614#post82614 - Salbutamol no doctor, Salbutamol online no prescription overnight shipping http://www.flora-electronica.com/content/buy-pilex-approved-us-pharmacy-order-pilex-using-mastercard - Buy Pilex http://www.grupoalarcon.com/es/flonase-online-mastercard-cheap-flonase-canada - flonase online mastercard, cheap flonase canada https://filanthrope.org/groups/buy-celebrex-online-fedex-delivery-celebrex-canada-pharmacy - Buy Celebrex Online FedEx Delivery, Celebrex Canada Pharmacy http://www.trioitservices.in/?q=node/124540 - http://www.trioitservices.in/?q=node/124540 Topiramate Side Effects Topamax Levitra Melbourne Ofloxacin Sales Cheap http://www.flora-electronica.com/content/buy-lodine-online-without-prescription-lodine-no-prior-prescription - Buy Lodine http://www.jrmonline.com/forums/topic/accutane-no-prescription-online-buy-accutane-canada-pharmacy - http://www.jrmonline.com/forums/topic/accutane-no-prescription-online-buy-accutane-canada-pharmacy/ http://www.flora-electronica.com/content/buy-pletal-online-no-prescription-needed-buy-pletal-canada - Buy Pletal http://www.trioitservices.in/?q=node/125431 - http://www.trioitservices.in/?q=node/125431 Vermox Drug Hydatid Disease  
Anxiety Disease Online Prescription Medicine Viagra
TerriNal 1年前 (2017-05-12) 回复
Sleep apnea is a very difficult thing to live with, both for the sufferer and for people living and sleep with him or her. If you fit into either of these categories, then you know just how frustrating it can be. Read through the tips found in this article to learn the best way to survive this problem!

Skip sleeping pills if you are prone to bouts of sleep apnea. You may feel you need them to get to sleep, but they have a similar effect as alcohol on the body. They also have additional side effects besides the obvious ones. Stay away if you want to lessen your sleep apnea symptoms.

If you have sleep apnea, yet you drink alcohol and smoke cigarettes, quitting could alleviate your symptoms. Both smoking and drinking promote relaxation of the airways causing sleep apnea and excessive snoring. If you avoid these things, it may help your sleep apnea.

Avoid drinking alcohol to excess. Your muscles are relaxed by drinking alcohol. You may want to feel more relaxed, but it can exacerbate your apnea. When your throat muscles relax, your airway narrows and causes sleep apnea. If you're not going to give up alcohol, then just don't do it right before bedtime.

Sleeping at a high altitude can worsen your sleep apnea because of the lower levels of oxygen. If you are going to a place located higher than what you are used to, take a CPAP machine with you. The best thing to do would be to completely avoid high altitude.

Clear up your nasal passage before heading to bed. If you suffer from sleep apnea and have problems with a "stuffed up" nose, using a nasal spray or device can help clear your nasal airway. This is not a permanent solution, but one you can use when your apnea symptoms are the worst.

If you have been diagnosed with sleep apnea, it is important to avoid drinking alcohol. Alcoholic beverages will relax the muscles in your throat, which makes it more likely that they will block your airway during your sleep. At the very least, avoid any alcoholic beverages in the evening before you get ready for bed.

Avoid any type of drugs or alcohol if you are experiencing any type of sleep apnea. Drugs and alcohol will slow down your respiratory system, and that is known to be one of the causes of sleep apnea. If you are struggling with this issue, try to get some professional help to overcome these addictions.

If simple changes in your lifestyle, such as regular sleep hours and losing weight, have not eliminated your sleep apnea episodes, it is time to consult with a sleep specialist. The specific causes of your sleep apnea can be evaluated, and an individual treatment plan can be designed for you.

These tips were written especially for people who suffer from apnea, whether directly or indirectly as a bed partner. While it can be quite difficult to completely remove apnea from your life, there are ways to live with it, and these were touched on in this useful sleep apnea article.

<a href=https://www.viagrasansordonnancefr.com/>viagrasansordonnancefr.com</a>
LarryNes 1年前 (2017-03-15) 回复