Android examples for Account:Email Address
get Account Type For Account by email
/******************************************************************************* * Copyright (C) 2013 Google Inc./*from ww w.jav a2s .c o m*/ * Licensed to The Android Open Source Project. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ import com.android.mail.R; public class Main{ /** * Map of email address suffixes to tags sent to analytics. */ private static final String[][] SUFFIX_ACCOUNT_TYPES = { { "@gmail.com", "gmail" }, { "@googlemail.com", "gmail" }, { "@google.com", "google-corp" }, { "@hotmail.com", "hotmail" }, { "@outlook.com", "outlook" }, { "@yahoo.com", "yahoo" }, }; public static String getAccountTypeForAccount(String name) { if (name == null) { return "unknown"; } for (int i = 0; i < SUFFIX_ACCOUNT_TYPES.length; i++) { final String[] row = SUFFIX_ACCOUNT_TYPES[i]; if (name.endsWith(row[0])) { return row[1]; } } return "other"; } }