|
Android example source code file (Dictionary.java)
The Dictionary.java Android example source code/* * Copyright (C) 2009 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. */ package com.example.android.searchabledict; import android.content.res.Resources; import android.text.TextUtils; import android.util.Log; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * Contains logic to load the word of words and definitions and find a list of matching words * given a query. Everything is held in memory; this is not a robust way to serve lots of * words and is only for demo purposes. * * You may want to consider using an SQLite database. In practice, you'll want to make sure your * suggestion provider is as efficient as possible, as the system will be taxed while performing * searches across many sources for each keystroke the user enters into Quick Search Box. */ public class Dictionary { public static class Word { public final String word; public final String definition; public Word(String word, String definition) { this.word = word; this.definition = definition; } } private static final Dictionary sInstance = new Dictionary(); public static Dictionary getInstance() { return sInstance; } private final Map<String, List Other Android examples (source code examples)Here is a short list of links related to this Android Dictionary.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.