Pages

About

Pages - Menu

Ads 468x60px

Social Icons

Main Menu

Featured Posts

Thursday 19 June 2014

SQLiteDatabase

Use SQLiteDatabase


package app.Test;

import android.app.Activity;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Bundle;
import android.widget.TextView;

public class appTest extends Activity {
  private static String[] FROM "ID""TIME""TITLE"};
  private static String ORDER_BY = "TIME DESC";

  private EventsData events;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    events = new EventsData(this);
    try {
      addEvent("Hello, Android!");
      Cursor cursor = getEvents();
      showEvents(cursor);
    finally {
      events.close();
    }
  }

  private void addEvent(String string) {
    SQLiteDatabase db = events.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put("titme", System.currentTimeMillis());
    values.put("title", string);
    db.insertOrThrow("event", null, values);
  }

  private Cursor getEvents() {
    SQLiteDatabase db = events.getReadableDatabase();
    Cursor cursor = db.query("event", FROM, null, null, null, null,ORDER_BY);
    startManagingCursor(cursor);
    return cursor;
  }

  private void showEvents(Cursor cursor) {
    StringBuilder builder = new StringBuilder("Saved events:\n");
    while (cursor.moveToNext()) {
      long id = cursor.getLong(0);
      long time = cursor.getLong(1);
      String title = cursor.getString(2);
      builder.append(id).append(": ");
      builder.append(time).append(": ");
      builder.append(title).append("\n");
    }
    // Display on the screen
    TextView text = (TextViewfindViewById(R.id.empty);
    text.setText(builder);
  }

}

class EventsData extends SQLiteOpenHelper {
  private static final String DATABASE_NAME = "events.db";
  private static final int DATABASE_VERSION = 1;

  /** Create a helper object for the Events database */
  public EventsData(Context ctx) {
    super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
  }

  @Override
  public void onCreate(SQLiteDatabase db) {
    db.execSQL("CREATE TABLE event (id INTEGER PRIMARY KEY AUTOINCREMENT, time INTEGER,title TEXT NOT NULL);");
  }

  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    db.execSQL("DROP TABLE IF EXISTS event");
    onCreate(db);
  }
}
//main.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent">
   <!-- Note built-in ids for 'list' and 'empty' -->
   <ListView
      android:id="@+id/list"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"/>
   <TextView
      android:id="@+id/empty"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/empty" />
</LinearLayout>
//strings.xml

<?xml version="1.0" encoding="utf-8"?>

<resources>
   <string name="app_name">Events</string>
   <string name="empty">No events!</string>
</resources>



SQLiteDatabase wrapper 


import java.util.ArrayList;
import java.util.HashMap;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.util.Log;

class DataBase 
{
  public static final String DEBUG_TAG = "DataBase";
  
  public static final String QUREY_CREATE_TABLE = "CREATE TABLE \"_2013_\" (\"id\" INTEGER PRIMARY KEY NOT NULL DEFAULT 1, \"month\" INTEGER NOT NULL DEFAULT 0, \"day\" INTEGER NOT NULL DEFAULT 0, \"incoming_call_number\" INTEGER NOT NULL DEFAULT 0, \"incoming_call_time\" INTEGER NOT NULL DEFAULT 0, \"incoming_message_number\" INTEGER NOT NULL DEFAULT 0, \"outgoing_call_number\" INTEGER NOT NULL DEFAULT 0, \"outgoing_call_time\" INTEGER NOT NULL DEFAULT 0, \"outgoing_message_number\" INTEGER NOT NULL DEFAULT 0, \"total_call_number\" INTEGER NOT NULL DEFAULT 0, \"total_call_time\" INTEGER NOT NULL DEFAULT 0, \"total_message_number\" INTEGER NOT NULL DEFAULT 0)";
  
  SQLiteDatabase mDataBase = null;
  
  Context mContext = null;
  
  public DataBase(Context context)
  {
    mContext = context;
  }
  
  public boolean isExistString databaseName )
  {
    boolean result = false;

    String[] list = mContext.databaseList();
    
    forString name : list )
    {
      ifname.equals(databaseName) )
      {
        result = true;
      }
    }
    
    return result;
  }
  
  public boolean create(String name)
  {
    boolean result = false;
    
    try
    {

      mDataBase = mContext.openOrCreateDatabase(name, SQLiteDatabase.CREATE_IF_NECESSARY, null);
      
      result = true;
    }
    catch(SQLiteException e)
    {
      Log.e(DEBUG_TAG, e.getMessage());
    }
    
    return result;
  }
  
  public boolean open(String name)
  {
    boolean result = false;
    
    if(mDataBase == null)
    {
      try
      {
        mDataBase = mContext.openOrCreateDatabase(name, SQLiteDatabase.OPEN_READWRITE, null);
        
        result = true;
      }
      catch(SQLiteException e)
      {
        Log.e(DEBUG_TAG, e.getMessage());
      }
      
    }
    
    return result;
  }
  
  
  public void insert(String tableName, ContentValues values)
  {
    try
    {
      mDataBase.insertOrThrow(tableName, null, values);
    }
    catch(SQLException e)
    {
      Log.e(DEBUG_TAG, e.getMessage());
    }
  }
  
  public void deleteAllRecord(String tableName)
  {
    mDataBase.delete(tableName,null, null);
  }
  
  public void createTable(String query)
  {
    mDataBase.execSQL(query);
  }
  
  public final ArrayList<HashMap<String, Integer>> getData(String tableName)
  {
    Cursor c = null;
    
    c = mDataBase.query(tableName, null, null, null, null, null, null);
    
    // ????? ??? ????? ???? ?? ??
    int columnSize = c.getColumnCount();
    // ????? ?????????? ????
    int resultSize = c.getCount();
    
    ArrayList<HashMap<String, Integer>> data = new ArrayList<HashMap<String,Integer>>(resultSize);
    
    c.moveToFirst();
    
    while(c.isAfterLast() == false)
    {
      HashMap<String, Integer> map = new HashMap<String, Integer>(columnSize);
      
      for(int j = 0; j < columnSize; j++)
      {
        map.put(c.getColumnName(j)new Integer(c.getInt(j)));
      }
      
      c.moveToNext();
      
      data.add(map);
    }
    
    return  data; 
  }
  
}



SQLiteDatabase Helper class


//package com.fit.aSeaBus.utils;

import java.io.Serializable;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

@SuppressWarnings("serial")
abstract class DaoUtils implements Serializable {

  protected final String DB_NAME = "SeaBusDB";
  protected String TBL_NAME;
  protected SQLiteDatabase sql;
  protected String[] attrs;

  public SQLiteDatabase createDB(Context ctx) {
    SQLiteDatabase sql = null;
    try {
      sql = ctx.openOrCreateDatabase(DB_NAME,
          SQLiteDatabase.CREATE_IF_NECESSARY, null);
    catch (Exception e) {
      sql.close();
      sql = ctx.openOrCreateDatabase(DB_NAME,
          SQLiteDatabase.CREATE_IF_NECESSARY, null);
    }
    return sql;
  }

  public void close() {
    if (sql != null) {
      sql.close();
    }
  }

  public void delete(String whereClausethrows Exception {
    sql.delete(TBL_NAME, whereClause, null);
  }

  public long insert(String[] attr) {
    ContentValues initialValues = new ContentValues();
    for (int i = 0; i < attr.length; i += 2) {
      initialValues.put(attr[i], attr[i + 1]);
    }
    long i = -1;
    try {
      i = sql.insert(TBL_NAME, null, initialValues);
    catch (Exception e) {
      Log.e("Hata", e.toString());
      e.printStackTrace();
    }
    return i;
  }

  public Cursor getAllRows(String table, String[] var) {
    try {
      return sql.query(table, var, null, null, null, null, null);
    catch (Exception e) {
      System.out.println(e.toString());
      Log.e("Exception on query", e.toString());
      return null;
    }
  }

  public Cursor execSQL(String[] st, String[] var) {
    try {
      String query = TBL_NAME + " WHERE ";
      boolean k = false;
      for (int i = 0; i < var.length; i++) {
        if (k)
          query += " AND ";
        else
          k = true;
        query += st[i" = '" + var[i"'";
      }
      return sql.query(query, null, null, null, null, null, null);
    catch (Exception e) {
      System.out.println(e.toString());
      Log.e("Exception on query", e.toString());
      return null;
    }
  }
}



Using Database 


/*
Welcome to the source code for Android Programming Tutorials (http://commonsware.com/AndTutorials)!

Specifically, this is for Version 3.2 and above of this book.
For the source code for older versions of this book, please
visit:

https://github.com/commonsguy/cw-andtutorials

All of the source code in this archive is licensed under the
Apache 2.0 license except as noted.

The names of the top-level directories roughly correspond to a
shortened form of the chapter titles. Since chapter numbers
change with every release, and since some samples are used by
multiple chapters, I am loathe to put chapter numbers in the
actual directory names.

If you wish to use this code, bear in mind a few things:

* The projects are set up to be built by Ant, not by Eclipse.
  If you wish to use the code with Eclipse, you will need to
  create a suitable Android Eclipse project and import the
  code and other assets.

* You should delete build.xml from the project, then run

    android update project -p ...
  (where ... is the path to a project of interest)

  on those projects you wish to use, so the build files are
  updated for your Android SDK version.

*/


package apt.tutorial;

import android.content.Context;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;

class RestaurantHelper extends SQLiteOpenHelper {
  private static final String DATABASE_NAME="lunchlist.db";
  private static final int SCHEMA_VERSION=1;
  
  public RestaurantHelper(Context context) {
    super(context, DATABASE_NAME, null, SCHEMA_VERSION);
  }
  
  @Override
  public void onCreate(SQLiteDatabase db) {
    db.execSQL("CREATE TABLE restaurants (_id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, address TEXT, type TEXT, notes TEXT);");
  }

  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // no-op, since will not be called until 2nd schema
    // version exists
  }

  public Cursor getAll() {
    return(getReadableDatabase()
            .rawQuery("SELECT _id, name, address, type, notes FROM restaurants ORDER BY name",
                      null));
  }
  
  public void insert(String name, String address,
                     String type, String notes) {
    ContentValues cv=new ContentValues();
          
    cv.put("name", name);
    cv.put("address", address);
    cv.put("type", type);
    cv.put("notes", notes);
    
    getWritableDatabase().insert("restaurants""name", cv);
  }
  
  public String getName(Cursor c) {
    return(c.getString(1));
  }
  
  public String getAddress(Cursor c) {
    return(c.getString(2));
  }
  
  public String getType(Cursor c) {
    return(c.getString(3));
  }
  
  public String getNotes(Cursor c) {
    return(c.getString(4));
  }
}








//11-Database\LunchList\src\apt\tutorial\LunchList.java
package apt.tutorial;

import android.app.TabActivity;
import android.content.Context;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.LayoutInflater;
import android.widget.AdapterView;
import android.widget.CursorAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RadioGroup;
import android.widget.TabHost;
import android.widget.TextView;

public class LunchList extends TabActivity {
  Cursor model=null;
  RestaurantAdapter adapter=null;
  EditText name=null;
  EditText address=null;
  EditText notes=null;
  RadioGroup types=null;
  RestaurantHelper helper=null;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    
    helper=new RestaurantHelper(this);
    
    name=(EditText)findViewById(R.id.name);
    address=(EditText)findViewById(R.id.addr);
    notes=(EditText)findViewById(R.id.notes);
    types=(RadioGroup)findViewById(R.id.types);
    
    Button save=(Button)findViewById(R.id.save);
    
    save.setOnClickListener(onSave);
    
    ListView list=(ListView)findViewById(R.id.restaurants);
    
    model=helper.getAll();
    startManagingCursor(model);
    adapter=new RestaurantAdapter(model);
    list.setAdapter(adapter);
    
    TabHost.TabSpec spec=getTabHost().newTabSpec("tag1");
    
    spec.setContent(R.id.restaurants);
    spec.setIndicator("List", getResources()
                                .getDrawable(R.drawable.list));
    getTabHost().addTab(spec);
    
    spec=getTabHost().newTabSpec("tag2");
    spec.setContent(R.id.details);
    spec.setIndicator("Details", getResources()
                                  .getDrawable(R.drawable.restaurant));
    getTabHost().addTab(spec);
    
    getTabHost().setCurrentTab(0);
    
    list.setOnItemClickListener(onListClick);
  }
  
  @Override
  public void onDestroy() {
    super.onDestroy();
    
    helper.close();
  }
  
  private View.OnClickListener onSave=new View.OnClickListener() {
    public void onClick(View v) {
      String type=null;
      
      switch (types.getCheckedRadioButtonId()) {
        case R.id.sit_down:
          type="sit_down";
          break;
        case R.id.take_out:
          type="take_out";
          break;
        case R.id.delivery:
          type="delivery";
          break;
      }
      
      helper.insert(name.getText().toString(),
                    address.getText().toString(), type,
                    notes.getText().toString());
      model.requery();
    }
  };
  
  private AdapterView.OnItemClickListener onListClick=new AdapterView.OnItemClickListener() {
    public void onItemClick(AdapterView<?> parent,
                              View view, int position,
                              long id) {
      model.moveToPosition(position);
      name.setText(helper.getName(model));
      address.setText(helper.getAddress(model));
      notes.setText(helper.getNotes(model));
      
      if (helper.getType(model).equals("sit_down")) {
        types.check(R.id.sit_down);
      }
      else if (helper.getType(model).equals("take_out")) {
        types.check(R.id.take_out);
      }
      else {
        types.check(R.id.delivery);
      }
      
      getTabHost().setCurrentTab(1);
    }
  };
  
  class RestaurantAdapter extends CursorAdapter {
    RestaurantAdapter(Cursor c) {
      super(LunchList.this, c);
    }
    
    @Override
    public void bindView(View row, Context ctxt,
                         Cursor c) {
      RestaurantHolder holder=(RestaurantHolder)row.getTag();
      
      holder.populateFrom(c, helper);
    }
    
    @Override
    public View newView(Context ctxt, Cursor c,
                         ViewGroup parent) {
      LayoutInflater inflater=getLayoutInflater();
      View row=inflater.inflate(R.layout.row, parent, false);
      RestaurantHolder holder=new RestaurantHolder(row);
      
      row.setTag(holder);
      
      return(row);
    }
  }
  
  static class RestaurantHolder {
    private TextView name=null;
    private TextView address=null;
    private ImageView icon=null;
    
    RestaurantHolder(View row) {
      name=(TextView)row.findViewById(R.id.title);
      address=(TextView)row.findViewById(R.id.address);
      icon=(ImageView)row.findViewById(R.id.icon);
    }
    
    void populateFrom(Cursor c, RestaurantHelper helper) {
      name.setText(helper.getName(c));
      address.setText(helper.getAddress(c));
  
      if (helper.getType(c).equals("sit_down")) {
        icon.setImageResource(R.drawable.ball_red);
      }
      else if (helper.getType(c).equals("take_out")) {
        icon.setImageResource(R.drawable.ball_yellow);
      }
      else {
        icon.setImageResource(R.drawable.ball_green);
      }
    }
  }
}


//11-Database\LunchList\res\values\strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">LunchList</string>
</resources>


//11-Database\LunchList\res\menu\option.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:id="@+id/toast"
    android:title="Raise Toast"
    android:icon="@drawable/toast"
  />
  <item android:id="@+id/run"
    android:title="Run Long Task"
    android:icon="@drawable/run"
  />
</menu>



//11-Database\LunchList\res\layout-land\main.xml
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@android:id/tabhost"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
  <LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TabWidget android:id="@android:id/tabs"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
    />
    <FrameLayout android:id="@android:id/tabcontent"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      >
      <ListView android:id="@+id/restaurants"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
      />
      <TableLayout android:id="@+id/details"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:stretchColumns="1,3"
        android:paddingTop="4dip"
        >
        <TableRow>
          <TextView
            android:text="Name:"
            android:paddingRight="2dip"
          />
          <EditText
            android:id="@+id/name"
            android:maxWidth="140sp"
          />
          <TextView
            android:text="Address:"
            android:paddingLeft="2dip"
            android:paddingRight="2dip"
          />
          <EditText
            android:id="@+id/addr"
            android:maxWidth="140sp"
          />
        </TableRow>
        <TableRow>
          <TextView android:text="Type:" />
          <RadioGroup android:id="@+id/types">
            <RadioButton android:id="@+id/take_out"
              android:text="Take-Out"
            />
            <RadioButton android:id="@+id/sit_down"
              android:text="Sit-Down"
            />
            <RadioButton android:id="@+id/delivery"
              android:text="Delivery"
            />
          </RadioGroup>
          <TextView
            android:text="Notes:"
            android:paddingLeft="2dip"
          />
          <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical"
            >
            <EditText android:id="@+id/notes"
              android:singleLine="false"
              android:gravity="top"
              android:lines="2"
              android:scrollHorizontally="false"
              android:maxLines="2"
              android:maxWidth="140sp"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
            />
            <Button android:id="@+id/save"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="Save"
            />
          </LinearLayout>
        </TableRow>
      </TableLayout>
    </FrameLayout>
  </LinearLayout>
</TabHost>


//11-Database\LunchList\res\layout\row.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="horizontal"
  android:padding="4dip"
  >
  <ImageView android:id="@+id/icon"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_alignParentTop="true"
    android:layout_alignParentBottom="true"
    android:layout_marginRight="4dip"
  />
  <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    >  
    <TextView android:id="@+id/title"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:gravity="center_vertical"
      android:textStyle="bold"
      android:singleLine="true"
      android:ellipsize="end"
    />
    <TextView android:id="@+id/address"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:gravity="center_vertical"
      android:singleLine="true"
      android:ellipsize="end"
    />
  </LinearLayout>
</LinearLayout>


//11-Database\LunchList\res\layout\main.xml
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@android:id/tabhost"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
  <LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TabWidget android:id="@android:id/tabs"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
    />
    <FrameLayout android:id="@android:id/tabcontent"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      >
      <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
        <ListView android:id="@+id/restaurants"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
        />
      </LinearLayout>
      <TableLayout android:id="@+id/details"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:stretchColumns="1"
        android:paddingTop="4dip"
        >
        <TableRow>
          <TextView android:text="Name:" />
          <EditText android:id="@+id/name" />
        </TableRow>
        <TableRow>
          <TextView android:text="Address:" />
          <EditText android:id="@+id/addr" />
        </TableRow>
        <TableRow>
          <TextView android:text="Type:" />
          <RadioGroup android:id="@+id/types">
            <RadioButton android:id="@+id/take_out"
              android:text="Take-Out"
            />
            <RadioButton android:id="@+id/sit_down"
              android:text="Sit-Down"
            />
            <RadioButton android:id="@+id/delivery"
              android:text="Delivery"
            />
          </RadioGroup>
        </TableRow>
        <TableRow>
          <TextView android:text="Notes:" />
          <EditText android:id="@+id/notes"
            android:singleLine="false"
            android:gravity="top"
            android:lines="2"
            android:scrollHorizontally="false"
            android:maxLines="2"
            android:maxWidth="200sp"
          />
        </TableRow>
        <Button android:id="@+id/save"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="Save"
        />
      </TableLayout>
    </FrameLayout>
  </LinearLayout>
</TabHost>
 



SQLite based diary app 


/*
 * Copyright (C) 2008 Google Inc.
 *
 * 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.savedInstanceState
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.eoeAndroid.SQLite;

import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

/**
 @author jinyan
 
 */
 

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import java.util.Calendar;
import java.util.Date;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

 class DiaryDbAdapter {

  public static final String KEY_TITLE = "title";
  public static final String KEY_BODY = "body";
  public static final String KEY_ROWID = "_id";
  public static final String KEY_CREATED = "created";

  private static final String TAG = "DiaryDbAdapter";
  private DatabaseHelper mDbHelper;
  private SQLiteDatabase mDb;

  private static final String DATABASE_CREATE = "create table diary (_id integer primary key autoincrement, "
      "title text not null, body text not null, created text not null);";

  private static final String DATABASE_NAME = "database";
  private static final String DATABASE_TABLE = "diary";
  private static final int DATABASE_VERSION = 1;

  private final Context mCtx;

  private static class DatabaseHelper extends SQLiteOpenHelper {

    DatabaseHelper(Context context) {
      super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
      db.execSQL(DATABASE_CREATE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
      db.execSQL("DROP TABLE IF EXISTS diary");
      onCreate(db);
    }
  }

  public DiaryDbAdapter(Context ctx) {
    this.mCtx = ctx;
  }

  public DiaryDbAdapter open() throws SQLException {
    mDbHelper = new DatabaseHelper(mCtx);
    mDb = mDbHelper.getWritableDatabase();
    return this;
  }

  public void closeclose() {
    mDbHelper.close();
  }

  public long createDiary(String title, String body) {
    ContentValues initialValues = new ContentValues();
    initialValues.put(KEY_TITLE, title);
    initialValues.put(KEY_BODY, body);
    Calendar calendar = Calendar.getInstance();
    String created = calendar.get(Calendar.YEAR"Äê"
        + calendar.get(Calendar.MONTH"ÔÂ"
        + calendar.get(Calendar.DAY_OF_MONTH"ÈÕ"
        + calendar.get(Calendar.HOUR_OF_DAY"ʱ"
        + calendar.get(Calendar.MINUTE"·Ö";
    initialValues.put(KEY_CREATED, created);
    return mDb.insert(DATABASE_TABLE, null, initialValues);
  }

  public boolean deleteDiary(long rowId) {

    return mDb.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null0;
  }

  public Cursor getAllNotes() {

    return mDb.query(DATABASE_TABLE, new String[] { KEY_ROWID, KEY_TITLE,
        KEY_BODY, KEY_CREATED }, null, null, null, null, null);
  }

  public Cursor getDiary(long rowIdthrows SQLException {

    Cursor mCursor =

    mDb.query(true, DATABASE_TABLE, new String[] { KEY_ROWID, KEY_TITLE,
        KEY_BODY, KEY_CREATED }, KEY_ROWID + "=" + rowId, null, null,
        null, null, null);
    if (mCursor != null) {
      mCursor.moveToFirst();
    }
    return mCursor;

  }

  public boolean updateDiary(long rowId, String title, String body) {
    ContentValues args = new ContentValues();
    args.put(KEY_TITLE, title);
    args.put(KEY_BODY, body);
    Calendar calendar = Calendar.getInstance();
    String created = calendar.get(Calendar.YEAR"Äê"
        + calendar.get(Calendar.MONTH"ÔÂ"
        + calendar.get(Calendar.DAY_OF_MONTH"ÈÕ"
        + calendar.get(Calendar.HOUR_OF_DAY"ʱ"
        + calendar.get(Calendar.MINUTE"·Ö";
    args.put(KEY_CREATED, created);

    return mDb.update(DATABASE_TABLE, args, KEY_ROWID + "=" + rowId, null0;
  }
}

 class ActivityDiaryEdit extends Activity {

  private EditText mTitleText;
  private EditText mBodyText;
  private Long mRowId;
  private DiaryDbAdapter mDbHelper;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mDbHelper = new DiaryDbAdapter(this);
    mDbHelper.open();
    setContentView(R.layout.diary_edit);

    mTitleText = (EditTextfindViewById(R.id.title);
    mBodyText = (EditTextfindViewById(R.id.body);

    Button confirmButton = (ButtonfindViewById(R.id.confirm);

    mRowId = null;
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
      String title = extras.getString(DiaryDbAdapter.KEY_TITLE);
      String body = extras.getString(DiaryDbAdapter.KEY_BODY);
      mRowId = extras.getLong(DiaryDbAdapter.KEY_ROWID);

      if (title != null) {
        mTitleText.setText(title);
      }
      if (body != null) {
        mBodyText.setText(body);
      }
    }

    confirmButton.setOnClickListener(new View.OnClickListener() {
      public void onClick(View view) {
        String title = mTitleText.getText().toString();
        String body = mBodyText.getText().toString();
        if (mRowId != null) {
          mDbHelper.updateDiary(mRowId, title, body);
        else
          mDbHelper.createDiary(title, body);
        Intent mIntent = new Intent();
        setResult(RESULT_OK, mIntent);
        finish();
      }

    });
  }
}

public class ActivityMain extends ListActivity {
  private static final int ACTIVITY_CREATE = 0;
  private static final int ACTIVITY_EDIT = 1;

  private static final int INSERT_ID = Menu.FIRST;
  private static final int DELETE_ID = Menu.FIRST + 1;

  private DiaryDbAdapter mDbHelper;
  private Cursor mDiaryCursor;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.diary_list);
    mDbHelper = new DiaryDbAdapter(this);
    mDbHelper.open();
    renderListView();

  }

  private void renderListView() {
    mDiaryCursor = mDbHelper.getAllNotes();
    startManagingCursor(mDiaryCursor);
    String[] from new String[] { DiaryDbAdapter.KEY_TITLE,
        DiaryDbAdapter.KEY_CREATED };
    int[] to = new int[] { R.id.text1, R.id.created };
    SimpleCursorAdapter notes = new SimpleCursorAdapter(this,
        R.layout.diary_row, mDiaryCursor, from, to);
    setListAdapter(notes);
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    menu.add(0, INSERT_ID, 0, R.string.menu_insert);
    menu.add(0, DELETE_ID, 0, R.string.menu_delete);
    return true;
  }

  @Override
  public boolean onMenuItemSelected(int featureId, MenuItem item) {
    switch (item.getItemId()) {
    case INSERT_ID:
      createDiary();
      return true;
    case DELETE_ID:
      mDbHelper.deleteDiary(getListView().getSelectedItemId());
      renderListView();
      return true;
    }
    return super.onMenuItemSelected(featureId, item);
  }

  private void createDiary() {
    Intent i = new Intent(this, ActivityDiaryEdit.class);
    startActivityForResult(i, ACTIVITY_CREATE);
  }

  @Override

  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    Cursor c = mDiaryCursor;
    c.moveToPosition(position);
    Intent i = new Intent(this, ActivityDiaryEdit.class);
    i.putExtra(DiaryDbAdapter.KEY_ROWID, id);
    i.putExtra(DiaryDbAdapter.KEY_TITLE, c.getString(c
        .getColumnIndexOrThrow(DiaryDbAdapter.KEY_TITLE)));
    i.putExtra(DiaryDbAdapter.KEY_BODY, c.getString(c
        .getColumnIndexOrThrow(DiaryDbAdapter.KEY_BODY)));
    startActivityForResult(i, ACTIVITY_EDIT);
  }

  @Override
  protected void onActivityResult(int requestCode, int resultCode,
      Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);
    renderListView();
  }
}
//diary_list.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">

  <ListView android:id="@+id/android:list"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
  <TextView android:id="@+id/android:empty"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="" />
</LinearLayout>

//diary_now.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/row"
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">

  <TextView android:id="@+id/text1"
    android:layout_width="wrap_content" android:layout_height="30px"
    android:maxWidth="200dip" 
    android:textSize="22sp"
    android:layout_marginTop="10dip"
    android:text="??????" />
  <TextView android:id="@+id/created" android:layout_width="wrap_content"
    android:layout_height="35px" android:layout_alignParentRight="true"
    android:layout_marginLeft="10dip" 
    android:layout_marginTop="10dip"
    android:text="1999?12?3?" />

</RelativeLayout>

//diary_now.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical" android:layout_width="fill_parent"
  android:layout_height="fill_parent">

  <LinearLayout android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <TextView android:layout_width="wrap_content"
      android:layout_height="wrap_content" android:text="@string/title"
      android:padding="2px" />
    <EditText android:id="@+id/title"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" android:layout_weight="1" />
  </LinearLayout>

  <TextView android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="@string/body" />
  <EditText android:id="@+id/body" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:layout_weight="1"
    android:scrollbars="vertical" android:gravity="top" />

  <Button android:id="@+id/confirm" android:text="@string/confirm"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

</LinearLayout>
 




Create table, insert record, delete records, query table, remove table 



package app.test;

import android.app.Activity;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Test extends Activity {
  OnClickListener listener1 = null;
  OnClickListener listener2 = null;
  OnClickListener listener3 = null;
  OnClickListener listener4 = null;
  OnClickListener listener5 = null;

  Button button1;
  Button button2;
  Button button3;
  Button button4;
  Button button5;

  DatabaseHelper mOpenHelper;

  private static final String DATABASE_NAME = "dbForTest.db";
  private static final int DATABASE_VERSION = 1;
  private static final String TABLE_NAME = "diary";
  private static final String TITLE = "title";
  private static final String BODY "body";

  private static class DatabaseHelper extends SQLiteOpenHelper {
    DatabaseHelper(Context context) {
      super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {

      String sql = "CREATE TABLE " + TABLE_NAME + " (" + TITLE
          " text not null, " BODY " text not null " ");";
      Log.i("haiyang:createDB=", sql);
      db.execSQL(sql);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    }
  }

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    prepareListener();
    initLayout();
    mOpenHelper = new DatabaseHelper(this);

  }

  private void initLayout() {
    button1 = (ButtonfindViewById(R.id.button1);
    button1.setOnClickListener(listener1);

    button2 = (ButtonfindViewById(R.id.button2);
    button2.setOnClickListener(listener2);

    button3 = (ButtonfindViewById(R.id.button3);
    button3.setOnClickListener(listener3);
    button4 = (ButtonfindViewById(R.id.button4);
    button4.setOnClickListener(listener4);

    button5 = (ButtonfindViewById(R.id.button5);
    button5.setOnClickListener(listener5);

  }

  private void prepareListener() {
    listener1 = new OnClickListener() {
      public void onClick(View v) {
        CreateTable();
      }
    };
    listener2 = new OnClickListener() {
      public void onClick(View v) {
        dropTable();
      }
    };
    listener3 = new OnClickListener() {
      public void onClick(View v) {
        insertItem();
      }
    };
    listener4 = new OnClickListener() {
      public void onClick(View v) {
        deleteItem();
      }
    };
    listener5 = new OnClickListener() {
      public void onClick(View v) {
        showItems();
      }
    };
  }
  private void CreateTable() {
    SQLiteDatabase db = mOpenHelper.getWritableDatabase();
    String sql = "CREATE TABLE " + TABLE_NAME + " (" + TITLE
        " text not null, " BODY " text not null " ");";
    Log.i("createDB=", sql);

    try {
      db.execSQL("DROP TABLE IF EXISTS diary");
      db.execSQL(sql);
      setTitle("drop");
    catch (SQLException e) {
      setTitle("exception");
    }
  }
  private void dropTable() {
    SQLiteDatabase db = mOpenHelper.getWritableDatabase();
    String sql = "drop table " + TABLE_NAME;
    try {
      db.execSQL(sql);
      setTitle(sql);
    catch (SQLException e) {
      setTitle("exception");
    }
  }
  private void insertItem() {
    SQLiteDatabase db = mOpenHelper.getWritableDatabase();
    String sql1 = "insert into " + TABLE_NAME + " (" + TITLE + ", " BODY
        ") values('a', 'b');";
    String sql2 = "insert into " + TABLE_NAME + " (" + TITLE + ", " BODY
        ") values('c', 'd');";
    try {
      Log.i("sql1=", sql1);
      Log.i("sql2=", sql2);
      db.execSQL(sql1);
      db.execSQL(sql2);
      setTitle("done");
    catch (SQLException e) {
      setTitle("exception");
    }
  }

  private void deleteItem() {
    try {
      SQLiteDatabase db = mOpenHelper.getWritableDatabase();
      db.delete(TABLE_NAME, " title = 'haiyang'"null);
      setTitle("title");
    catch (SQLException e) {

    }

  }
  private void showItems() {

    SQLiteDatabase db = mOpenHelper.getReadableDatabase();
    String col[] TITLE, BODY };
    Cursor cur = db.query(TABLE_NAME, col, null, null, null, null, null);
    Integer num = cur.getCount();
    setTitle(Integer.toString(num));
  }
}
//main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical" android:layout_width="fill_parent"
  android:layout_height="fill_parent">
  <Button android:id="@+id/button3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="Insert" />
  <Button android:id="@+id/button4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="Delete" />
  <Button android:id="@+id/button5"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="Query" />
  <Button android:id="@+id/button2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="Delete table" />
  <Button android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="Recreate table" />

</LinearLayout>




Insert Data into database 


package app.test;

import java.text.SimpleDateFormat;
import java.util.Date;

import android.app.Activity;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

 class MyDbHelper extends SQLiteOpenHelper {

    private static final String DB_NAME = "mydb";
    private static final int DB_VERSION = 1;
    
    public static final String TABLE_NAME = "student";
    public static final String COL_NAME = "pName";
    public static final String COL_DATE = "pDate";
    private static final String STRING_CREATE = "CREATE TABLE "+TABLE_NAME+" (_id INTEGER PRIMARY KEY AUTOINCREMENT, "
        +COL_NAME+" TEXT, "+COL_DATE+" DATE);";

    public MyDbHelper(Context context) {
        super(context, DB_NAME, null, DB_VERSION);
    }
    
    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(STRING_CREATE);
        ContentValues cv = new ContentValues(2);
        cv.put(COL_NAME, "New Entry");
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        cv.put(COL_DATE, dateFormat.format(new Date()))
        db.insert(TABLE_NAME, null, cv);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS "+TABLE_NAME);
        onCreate(db);
    }
}

public class Test extends Activity implements View.OnClickListener, AdapterView.OnItemClickListener {

    EditText mText;
    Button mAdd;
    ListView mList;
    
    MyDbHelper mHelper;
    SQLiteDatabase mDb;
    Cursor mCursor;
    SimpleCursorAdapter mAdapter;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        mText = (EditText)findViewById(R.id.name);
        mAdd = (Button)findViewById(R.id.add);
        mAdd.setOnClickListener(this);
        mList = (ListView)findViewById(R.id.list);
        mList.setOnItemClickListener(this);
        
        mHelper = new MyDbHelper(this);
    }
    
    @Override
    public void onResume() {
        super.onResume();
        mDb = mHelper.getWritableDatabase();
        String[] columns = new String[] {"_id", MyDbHelper.COL_NAME, MyDbHelper.COL_DATE};
        mCursor = mDb.query(MyDbHelper.TABLE_NAME, columns, null, null, null, null, null, null);
        String[] headers = new String[] {MyDbHelper.COL_NAME, MyDbHelper.COL_DATE};
        mAdapter = new SimpleCursorAdapter(this, android.R.layout.two_line_list_item,
                mCursor, headers, new int[]{android.R.id.text1, android.R.id.text2});
        mList.setAdapter(mAdapter);
    }
    
    @Override
    public void onPause() {
        super.onPause();
        mDb.close();
        mCursor.close();
    }
    @Override
    public void onClick(View v) {
        ContentValues cv = new ContentValues(2);
        cv.put(MyDbHelper.COL_NAME, mText.getText().toString());
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        cv.put(MyDbHelper.COL_DATE, dateFormat.format(new Date()))//Insert 'now' as the date
        mDb.insert(MyDbHelper.TABLE_NAME, null, cv);
        mCursor.requery();
        mAdapter.notifyDataSetChanged();
        mText.setText(null);
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
        mCursor.moveToPosition(position);
        String rowId = mCursor.getString(0)//Column 0 of the cursor is the id
        mDb.delete(MyDbHelper.TABLE_NAME, "_id = ?"new String[]{rowId});
        mCursor.requery();
        mAdapter.notifyDataSetChanged();
    }
}

//main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
  <EditText
    android:id="@+id/name"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
  />
  <Button
    android:id="@+id/add"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Add New Person"
  />
  <ListView
    android:id="@+id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
  />
</LinearLayout>
 



Searchable Dictionary


//
//src\com\example\android\searchabledict\DictionaryDatabase.java
/*
 * Copyright (C) 2010 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.app.SearchManager;
import android.content.ContentValues;
import android.content.Context;
import android.content.res.Resources;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.provider.BaseColumns;
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.HashMap;

/**
 * Contains logic to return specific words from the dictionary, and
 * load the dictionary table when it needs to be created.
 */
public class DictionaryDatabase {
    private static final String TAG = "DictionaryDatabase";

    //The columns we'll include in the dictionary table
    public static final String KEY_WORD = SearchManager.SUGGEST_COLUMN_TEXT_1;
    public static final String KEY_DEFINITION = SearchManager.SUGGEST_COLUMN_TEXT_2;

    private static final String DATABASE_NAME = "dictionary";
    private static final String FTS_VIRTUAL_TABLE = "FTSdictionary";
    private static final int DATABASE_VERSION = 2;

    private final DictionaryOpenHelper mDatabaseOpenHelper;
    private static final HashMap<String,String> mColumnMap = buildColumnMap();

    /**
     * Constructor
     @param context The Context within which to work, used to create the DB
     */
    public DictionaryDatabase(Context context) {
        mDatabaseOpenHelper = new DictionaryOpenHelper(context);
    }

    /**
     * Builds a map for all columns that may be requested, which will be given to the 
     * SQLiteQueryBuilder. This is a good way to define aliases for column names, but must include 
     * all columns, even if the value is the key. This allows the ContentProvider to request
     * columns w/o the need to know real column names and create the alias itself.
     */
    private static HashMap<String,String> buildColumnMap() {
        HashMap<String,String> map = new HashMap<String,String>();
        map.put(KEY_WORD, KEY_WORD);
        map.put(KEY_DEFINITION, KEY_DEFINITION);
        map.put(BaseColumns._ID, "rowid AS " +
                BaseColumns._ID);
        map.put(SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID, "rowid AS " +
                SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID);
        map.put(SearchManager.SUGGEST_COLUMN_SHORTCUT_ID, "rowid AS " +
                SearchManager.SUGGEST_COLUMN_SHORTCUT_ID);
        return map;
    }

    /**
     * Returns a Cursor positioned at the word specified by rowId
     *
     @param rowId id of word to retrieve
     @param columns The columns to include, if null then all are included
     @return Cursor positioned to matching word, or null if not found.
     */
    public Cursor getWord(String rowId, String[] columns) {
        String selection = "rowid = ?";
        String[] selectionArgs = new String[] {rowId};

        return query(selection, selectionArgs, columns);

        /* This builds a query that looks like:
         *     SELECT <columns> FROM <table> WHERE rowid = <rowId>
         */
    }

    /**
     * Returns a Cursor over all words that match the given query
     *
     @param query The string to search for
     @param columns The columns to include, if null then all are included
     @return Cursor over all words that match, or null if none found.
     */
    public Cursor getWordMatches(String query, String[] columns) {
        String selection = KEY_WORD + " MATCH ?";
        String[] selectionArgs = new String[] {query+"*"};

        return query(selection, selectionArgs, columns);

        /* This builds a query that looks like:
         *     SELECT <columns> FROM <table> WHERE <KEY_WORD> MATCH 'query*'
         * which is an FTS3 search for the query text (plus a wildcard) inside the word column.
         *
         * - "rowid" is the unique id for all rows but we need this value for the "_id" column in
         *    order for the Adapters to work, so the columns need to make "_id" an alias for "rowid"
         * - "rowid" also needs to be used by the SUGGEST_COLUMN_INTENT_DATA alias in order
         *   for suggestions to carry the proper intent data.
         *   These aliases are defined in the DictionaryProvider when queries are made.
         * - This can be revised to also search the definition text with FTS3 by changing
         *   the selection clause to use FTS_VIRTUAL_TABLE instead of KEY_WORD (to search across
         *   the entire table, but sorting the relevance could be difficult.
         */
    }

    /**
     * Performs a database query.
     @param selection The selection clause
     @param selectionArgs Selection arguments for "?" components in the selection
     @param columns The columns to return
     @return A Cursor over all rows matching the query
     */
    private Cursor query(String selection, String[] selectionArgs, String[] columns) {
        /* The SQLiteBuilder provides a map for all possible columns requested to
         * actual columns in the database, creating a simple column alias mechanism
         * by which the ContentProvider does not need to know the real column names
         */
        SQLiteQueryBuilder builder = new SQLiteQueryBuilder();
        builder.setTables(FTS_VIRTUAL_TABLE);
        builder.setProjectionMap(mColumnMap);

        Cursor cursor = builder.query(mDatabaseOpenHelper.getReadableDatabase(),
                columns, selection, selectionArgs, null, null, null);

        if (cursor == null) {
            return null;
        else if (!cursor.moveToFirst()) {
            cursor.close();
            return null;
        }
        return cursor;
    }


    /**
     * This creates/opens the database.
     */
    private static class DictionaryOpenHelper extends SQLiteOpenHelper {

        private final Context mHelperContext;
        private SQLiteDatabase mDatabase;

        /* Note that FTS3 does not support column constraints and thus, you cannot
         * declare a primary key. However, "rowid" is automatically used as a unique
         * identifier, so when making requests, we will use "_id" as an alias for "rowid"
         */
        private static final String FTS_TABLE_CREATE =
                    "CREATE VIRTUAL TABLE " + FTS_VIRTUAL_TABLE +
                    " USING fts3 (" +
                    KEY_WORD + ", " +
                    KEY_DEFINITION + ");";

        DictionaryOpenHelper(Context context) {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
            mHelperContext = context;
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
            mDatabase = db;
            mDatabase.execSQL(FTS_TABLE_CREATE);
            loadDictionary();
        }

        /**
         * Starts a thread to load the database table with words
         */
        private void loadDictionary() {
            new Thread(new Runnable() {
                public void run() {
                    try {
                        loadWords();
                    catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                }
            }).start();
        }

        private void loadWords() throws IOException {
            Log.d(TAG, "Loading words...");
            final Resources resources = mHelperContext.getResources();
            InputStream inputStream = resources.openRawResource(R.raw.definitions);
            BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));

            try {
                String line;
                while ((line = reader.readLine()) != null) {
                    String[] strings = TextUtils.split(line, "-");
                    if (strings.length < 2continue;
                    long id = addWord(strings[0].trim(), strings[1].trim());
                    if (id < 0) {
                        Log.e(TAG, "unable to add word: " + strings[0].trim());
                    }
                }
            finally {
                reader.close();
            }
            Log.d(TAG, "DONE loading words.");
        }

        /**
         * Add a word to the dictionary.
         @return rowId or -1 if failed
         */
        public long addWord(String word, String definition) {
            ContentValues initialValues = new ContentValues();
            initialValues.put(KEY_WORD, word);
            initialValues.put(KEY_DEFINITION, definition);

            return mDatabase.insert(FTS_VIRTUAL_TABLE, null, initialValues);
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
                    + newVersion + ", which will destroy all old data");
            db.execSQL("DROP TABLE IF EXISTS " + FTS_VIRTUAL_TABLE);
            onCreate(db);
        }
    }

}



//src\com\example\android\searchabledict\DictionaryProvider.java
/*
 * Copyright (C) 2010 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.app.SearchManager;
import android.content.ContentProvider;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.net.Uri;
import android.provider.BaseColumns;

/**
 * Provides access to the dictionary database.
 */
public class DictionaryProvider extends ContentProvider {
    String TAG = "DictionaryProvider";

    public static String AUTHORITY = "com.example.android.searchabledict.DictionaryProvider";
    public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/dictionary");

    // MIME types used for searching words or looking up a single definition
    public static final String WORDS_MIME_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE +
                                                  "/vnd.example.android.searchabledict";
    public static final String DEFINITION_MIME_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE +
                                                       "/vnd.example.android.searchabledict";

    private DictionaryDatabase mDictionary;

    // UriMatcher stuff
    private static final int SEARCH_WORDS = 0;
    private static final int GET_WORD = 1;
    private static final int SEARCH_SUGGEST = 2;
    private static final int REFRESH_SHORTCUT = 3;
    private static final UriMatcher sURIMatcher = buildUriMatcher();

    /**
     * Builds up a UriMatcher for search suggestion and shortcut refresh queries.
     */
    private static UriMatcher buildUriMatcher() {
        UriMatcher matcher =  new UriMatcher(UriMatcher.NO_MATCH);
        // to get definitions...
        matcher.addURI(AUTHORITY, "dictionary", SEARCH_WORDS);
        matcher.addURI(AUTHORITY, "dictionary/#", GET_WORD);
        // to get suggestions...
        matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY, SEARCH_SUGGEST);
        matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH_SUGGEST);

        /* The following are unused in this implementation, but if we include
         * {@link SearchManager#SUGGEST_COLUMN_SHORTCUT_ID} as a column in our suggestions table, we
         * could expect to receive refresh queries when a shortcutted suggestion is displayed in
         * Quick Search Box, in which case, the following Uris would be provided and we
         * would return a cursor with a single item representing the refreshed suggestion data.
         */
        matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_SHORTCUT, REFRESH_SHORTCUT);
        matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_SHORTCUT + "/*", REFRESH_SHORTCUT);
        return matcher;
    }

    @Override
    public boolean onCreate() {
        mDictionary = new DictionaryDatabase(getContext());
        return true;
    }

    /**
     * Handles all the dictionary searches and suggestion queries from the Search Manager.
     * When requesting a specific word, the uri alone is required.
     * When searching all of the dictionary for matches, the selectionArgs argument must carry
     * the search query as the first element.
     * All other arguments are ignored.
     */
    @Override
    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
                        String sortOrder) {

        // Use the UriMatcher to see what kind of query we have and format the db query accordingly
        switch (sURIMatcher.match(uri)) {
            case SEARCH_SUGGEST:
                if (selectionArgs == null) {
                  throw new IllegalArgumentException(
                      "selectionArgs must be provided for the Uri: " + uri);
                }
                return getSuggestions(selectionArgs[0]);
            case SEARCH_WORDS:
                if (selectionArgs == null) {
                  throw new IllegalArgumentException(
                      "selectionArgs must be provided for the Uri: " + uri);
                }
                return search(selectionArgs[0]);
            case GET_WORD:
                return getWord(uri);
            case REFRESH_SHORTCUT:
                return refreshShortcut(uri);
            default:
                throw new IllegalArgumentException("Unknown Uri: " + uri);
        }
    }

    private Cursor getSuggestions(String query) {
      query = query.toLowerCase();
      String[] columns = new String[] {
          BaseColumns._ID,
          DictionaryDatabase.KEY_WORD,
          DictionaryDatabase.KEY_DEFINITION,
       /* SearchManager.SUGGEST_COLUMN_SHORTCUT_ID,
                        (only if you want to refresh shortcuts) */
          SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID};

      return mDictionary.getWordMatches(query, columns);
    }

    private Cursor search(String query) {
      query = query.toLowerCase();
      String[] columns = new String[] {
          BaseColumns._ID,
          DictionaryDatabase.KEY_WORD,
          DictionaryDatabase.KEY_DEFINITION};

      return mDictionary.getWordMatches(query, columns);
    }

    private Cursor getWord(Uri uri) {
      String rowId = uri.getLastPathSegment();
      String[] columns = new String[] {
          DictionaryDatabase.KEY_WORD,
          DictionaryDatabase.KEY_DEFINITION};

      return mDictionary.getWord(rowId, columns);
    }

    private Cursor refreshShortcut(Uri uri) {
      /* This won't be called with the current implementation, but if we include
       * {@link SearchManager#SUGGEST_COLUMN_SHORTCUT_ID} as a column in our suggestions table, we
       * could expect to receive refresh queries when a shortcutted suggestion is displayed in
       * Quick Search Box. In which case, this method will query the table for the specific
       * word, using the given item Uri and provide all the columns originally provided with the
       * suggestion query.
       */
      String rowId = uri.getLastPathSegment();
      String[] columns = new String[] {
          BaseColumns._ID,
          DictionaryDatabase.KEY_WORD,
          DictionaryDatabase.KEY_DEFINITION,
          SearchManager.SUGGEST_COLUMN_SHORTCUT_ID,
          SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID};

      return mDictionary.getWord(rowId, columns);
    }

    /**
     * This method is required in order to query the supported types.
     * It's also useful in our own query() method to determine the type of Uri received.
     */
    @Override
    public String getType(Uri uri) {
        switch (sURIMatcher.match(uri)) {
            case SEARCH_WORDS:
                return WORDS_MIME_TYPE;
            case GET_WORD:
                return DEFINITION_MIME_TYPE;
            case SEARCH_SUGGEST:
                return SearchManager.SUGGEST_MIME_TYPE;
            case REFRESH_SHORTCUT:
                return SearchManager.SHORTCUT_MIME_TYPE;
            default:
                throw new IllegalArgumentException("Unknown URL " + uri);
        }
    }

    // Other required implementations...

    @Override
    public Uri insert(Uri uri, ContentValues values) {
        throw new UnsupportedOperationException();
    }

    @Override
    public int delete(Uri uri, String selection, String[] selectionArgs) {
        throw new UnsupportedOperationException();
    }

    @Override
    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
        throw new UnsupportedOperationException();
    }

}



//src\com\example\android\searchabledict\SearchableDictionary.java
/*
 * Copyright (C) 2010 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.app.Activity;
import android.app.ActionBar;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SearchView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;

/**
 * The main activity for the dictionary.
 * Displays search results triggered by the search dialog and handles
 * actions from search suggestions.
 */
public class SearchableDictionary extends Activity {

    private TextView mTextView;
    private ListView mListView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mTextView = (TextViewfindViewById(R.id.text);
        mListView = (ListViewfindViewById(R.id.list);

        handleIntent(getIntent());
    }

    @Override
    protected void onNewIntent(Intent intent) {
        // Because this activity has set launchMode="singleTop", the system calls this method
        // to deliver the intent if this actvity is currently the foreground activity when
        // invoked again (when the user executes a search from this activity, we don't create
        // a new instance of this activity, so the system delivers the search intent here)
        handleIntent(intent);
    }

    private void handleIntent(Intent intent) {
        if (Intent.ACTION_VIEW.equals(intent.getAction())) {
            // handles a click on a search suggestion; launches activity to show word
            Intent wordIntent = new Intent(this, WordActivity.class);
            wordIntent.setData(intent.getData());
            startActivity(wordIntent);
            finish();
        else if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
            // handles a search query
            String query = intent.getStringExtra(SearchManager.QUERY);
            showResults(query);
        }
    }

    /**
     * Searches the dictionary and displays results for the given query.
     @param query The search query
     */
    private void showResults(String query) {

        Cursor cursor = managedQuery(DictionaryProvider.CONTENT_URI, null, null,
                                new String[] {query}null);

        if (cursor == null) {
            // There are no results
            mTextView.setText(getString(R.string.no_results, new Object[] {query}));
        else {
            // Display the number of results
            int count = cursor.getCount();
            String countString = getResources().getQuantityString(R.plurals.search_results,
                                    count, new Object[] {count, query});
            mTextView.setText(countString);

            // Specify the columns we want to display in the result
            String[] from new String[] { DictionaryDatabase.KEY_WORD,
                                           DictionaryDatabase.KEY_DEFINITION };

            // Specify the corresponding layout elements where we want the columns to go
            int[] to = new int[] { R.id.word,
                                   R.id.definition };

            // Create a simple cursor adapter for the definitions and apply them to the ListView
            SimpleCursorAdapter words = new SimpleCursorAdapter(this,
                                          R.layout.result, cursor, from, to);
            mListView.setAdapter(words);

            // Define the on-click listener for the list items
            mListView.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    // Build the Intent used to open WordActivity with a specific word Uri
                    Intent wordIntent = new Intent(getApplicationContext(), WordActivity.class);
                    Uri data = Uri.withAppendedPath(DictionaryProvider.CONTENT_URI,
                                                    String.valueOf(id));
                    wordIntent.setData(data);
                    startActivity(wordIntent);
                }
            });
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.options_menu, menu);

        SearchManager searchManager = (SearchManagergetSystemService(Context.SEARCH_SERVICE);
        SearchView searchView = (SearchViewmenu.findItem(R.id.search).getActionView();
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
        searchView.setIconifiedByDefault(false);

        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.search:
                onSearchRequested();
                return true;
            default:
                return false;
        }
    }
}



//src\com\example\android\searchabledict\WordActivity.java
/*
 * Copyright (C) 2010 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.app.Activity;
import android.app.ActionBar;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.SearchView;
import android.widget.TextView;

/**
 * Displays a word and its definition.
 */
public class WordActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.word);

        ActionBar actionBar = getActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);

        Uri uri = getIntent().getData();
        Cursor cursor = managedQuery(uri, null, null, null, null);

        if (cursor == null) {
            finish();
        else {
            cursor.moveToFirst();

            TextView word = (TextViewfindViewById(R.id.word);
            TextView definition = (TextViewfindViewById(R.id.definition);

            int wIndex = cursor.getColumnIndexOrThrow(DictionaryDatabase.KEY_WORD);
            int dIndex = cursor.getColumnIndexOrThrow(DictionaryDatabase.KEY_DEFINITION);

            word.setText(cursor.getString(wIndex));
            definition.setText(cursor.getString(dIndex));
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.options_menu, menu);

        SearchManager searchManager = (SearchManagergetSystemService(Context.SEARCH_SERVICE);
        SearchView searchView = (SearchViewmenu.findItem(R.id.search).getActionView();
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
        searchView.setIconifiedByDefault(false);
        
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.search:
                onSearchRequested();
                return true;
            case android.R.id.home:
                Intent intent = new Intent(this, SearchableDictionary.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(intent);
                return true;
            default:
                return false;
        }
    }
}



//
//res\layout\main.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2010, 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.
*/
-->
<!-- Layout for SearchableActivity.
 -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    <TextView
            android:id="@+id/text"
            android:textColor="?android:textColorPrimary"
            android:textSize="17dp"
            android:text="@string/search_instructions"
            android:background="@android:drawable/title_bar"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
    <ListView
            android:id="@+id/list"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />
</LinearLayout>





//res\layout\result.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2010, 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.
*/
-->
<!-- Layout for list items in the search results.
 -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp">
    <TextView
            android:id="@+id/word"
            style="@android:style/TextAppearance.Large"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    <TextView
            android:id="@+id/definition"
            style="@android:style/TextAppearance.Small"
            android:singleLine="true"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
</LinearLayout>



//res\layout\word.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2010, 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.
*/
-->
<!-- Layout for WordActivity.
 -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp">
    <TextView
            android:id="@+id/word"
            android:textSize="35dp"
            android:textColor="?android:textColorPrimary"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    <TextView
            android:id="@+id/definition"
            android:textSize="18dp"
            android:textColor="?android:textColorSecondary"
            android:paddingTop="10dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
</LinearLayout>



//
//res\menu\options_menu.xml
<!--
/*
** Copyright 2010, 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.
*/
-->
<!-- Options Menu for SearchableActivity and WordActivity.
 -->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/search"
          android:title="@string/menu_search"
          android:icon="@drawable/ic_menu_search"
          android:showAsAction="ifRoom"
          android:actionViewClass="android.widget.SearchView" />
</menu>



//
//res\raw\definitions.txt
abbey - n. a monastery ruled by an abbot
abide - v. dwell; inhabit or live in
abound - v. be abundant or plentiful; exist in large quantities
absence - n. the state of being absent
absorb - v. assimilate or take in
abstinence - n. practice of refraining from indulging an appetite especially alcohol
absurd - j. inconsistent with reason or logic or common sense
abundant - j. present in great quantity
abusive - j. characterized by physical or psychological maltreatment
academic - j. associated with school or learning
academy - n. a school for special training
accept - v. consider or hold as true
access - v. reach or gain access to
accessible - j. easily obtained
acclaim - n. enthusiastic approval
accommodate - v. provide with something desired or needed
accompany - v. go or travel along with
accomplish - v. to gain with effort
account - v. furnish a justifying analysis or explanation
accurate - j. conforming exactly or almost exactly to fact or to a standard or performing with total accuracy
accusation - n. an assertion that someone is guilty of a fault or offence
accuse - v. blame for, make a claim of wrongdoing or misbehavior against
acid - j. biting, sarcastic, or scornful
acknowledge - v. declare to be true or admit the existence or reality or truth of
acquire - v. come into the possession of something concrete or abstract
acquisition - n. something acquired or received
adamant - j. impervious to pleas, persuasion, requests, reason
adjacent - j. having a common boundary or edge; abutting; touching
administrator - n. someone who manages a government agency or department
advent - n. arrival that has been awaited (especially of something momentous)
adverse - j. contrary to your interests or welfare
advisory - n. an announcement that usually advises or warns the public of some threat
advocacy - n. active support of an idea or cause etc.; especially the act of pleading or arguing for something
advocate - v. speak, plead, or argue in favor of
affect - n. the conscious subjective aspect of feeling or emotion
affirmative - j. affirming or giving assent
aggression - n. violent action that is hostile and usually unprovoked
airy - j. not practical or realizable; speculative
album - n. a book of blank pages with pockets or envelopes; for organizing photographs or stamp collections etc
alcohol - n. a liquor or brew containing alcohol as the active agent
alien - j. being or from or characteristic of another place or part of the world
allegiance - n. the loyalty that citizens owe to their country (or subjects to their sovereign)
alley - n. a narrow street with walls on both sides
alliance - n. a formal agreement establishing an association or alliance between nations or other groups to achieve a particular aim
ally - n. an associate who provides cooperation or assistance
altar - n. a raised structure on which gifts or sacrifices to a god are made
alter - v. cause to change; make different; cause a transformation
alternate - j. serving or used in place of another
alternative - j. serving or used in place of another
altitude - n. elevation especially above sea level or above the earth's surface
amateur - j. lacking professional skill or expertise
ambiguous - j. having more than one possible meaning
ambitious - j. having a strong desire for success or achievement
ambivalent - j. uncertain or unable to decide about what course to follow
analogy - n. drawing a comparison in order to show a similarity in some respect
analyst - n. someone who is skilled at analyzing data
analyze - v. break down into components or essential features
anchor - v. fix firmly and stably
android - n. a robot designed to look and behave like a human being
annual - j. occurring or payable every year
anonymous - j. having no known name or identity or known source
antichrist - n. the adversary of Christ (or Christianitymentioned in the New Testament
antique - j. made in or typical of earlier times and valued for its age
anxious - j. causing or fraught with or showing anxiety
apartheid - n. a social policy or racial segregation involving political and economic and legal discrimination against people who are not Whites
apocalyptic - j. prophetic of devastation or ultimate doom
apology - n. an expression of regret at having caused trouble for someone
apparel - n. clothing in general
apparent - j. clearly revealed to the mind or the senses or judgment
appease - v. make peace with
appropriate - j. suitable for a particular person or place or condition etc
apt - j. being of striking appropriateness and pertinence
arbitrary - j. based on or subject to individual discretion or preference or sometimes impulse or caprice
arcade - n. a covered passageway with shops and stalls on either side
arrange - v. put into a proper or systematic order
arrangement - n. an orderly grouping (of things or personsconsidered as a unit; the result of arranging
arrival - n. the act of arriving at a certain place
arrogance - n. overbearing pride evidenced by a superior manner toward inferiors
arrogant - j. having or showing feelings of unwarranted importance out of overbearing pride
articulate - j. expressing yourself easily or characterized by clear expressive language
assassination - n. murder of a public figure by surprise attack
assess - v. set or determine the amount of (a payment such as a fine)
assets - n. anything of material value or usefulness that is owned by a person or company
asylum - n. a shelter from danger or hardship
auburn - j. (of haircolored a moderate reddish-brown
august - j. profoundly honored
aura - n. a distinctive but intangible quality surrounding a person or thing
austere - j. of a stern or strict bearing or demeanor; forbidding in aspect
authentic - j. not counterfeit or copied
authenticity - n. undisputed credibility
authoritarian - n. a person who behaves in a tyrannical manner
autobiography - n. a biography of yourself
autonomous - j. existing as an independent entity
autonomy - n. immunity from arbitrary exercise of authority: political independence
avid - j. marked by active interest and enthusiasm
banal - j. repeated too often; over familiar through overuse
barring - n. the act of excluding someone by a negative vote or veto
bass - n. the lowest adult male singing voice
batter - n. a liquid or semiliquid mixture, as of flour, eggs, and milk, used in cooking
belle - n. a young woman who is the most charming and beautiful of several rivals
beneficial - j. promoting or enhancing well-being
benefit - n. something that aids or promotes well-being
benign - j. not dangerous to health; not recurrent or progressive (especially of a tumor)
bid - n. a formal proposal to buy at a specified price
biography - n. an account of the series of events making up a person's life
biology - n. the science that studies living organisms
blaze - n. a strong flame that burns brightly
bleak - j. unpleasantly cold and damp
bogus - j. fraudulent; having a misleading appearance
bolster - v. support and strengthen
bomb - n. an explosive device fused to explode under specific conditions
bore - n. a person who evokes boredom
botanical - j. of or relating to plants or botany
boycott - n. a group's refusal to have commercial dealings with some organization in protest against its policies
brass - n. an alloy of copper and zinc
breach - n. an opening (especially a gap in a dike or fortification)
broadcast - n. message that is transmitted by radio or television
brokerage - n. the business of a broker; charges a fee to arrange a contract between two parties
buffet - n. a meal set out on a buffet at which guests help themselves
bumper - n. a mechanical device consisting of bars at either end of a vehicle to absorb shock and prevent serious damage
bureau - n. an administrative unit of government
bureaucracy - n. non elected government officials
butt - v. to strike, thrust or shove against
cabinet - n. persons appointed by a head of state to head executive departments of government and act as official advisers
caliber - n. a degree or grade of excellence or worth
campaign - n. a series of actions advancing a principle or tending toward a particular end
canon - n. a rule or especially body of rules or principles generally established as valid and fundamental in a field or art or philosophy
cardinal - j. serving as an essential component
caricature - n. a representation of a person that is exaggerated for comic effect
casual - j. without or seeming to be without plan or method; offhand
catastrophe - n. an event resulting in great loss and misfortune
caucus - n. a closed political meeting
causal - j. involving or constituting a cause; causing
censure - n. harsh criticism or disapproval
census - n. a periodic count of the population
cereal - n. grass whose starchy grains are used as food: wheat; rice; rye; oats; maize; buckwheat; millet
ceremonial - j. marked by pomp or ceremony or formality
chaos - n. a state of extreme confusion and disorder
characteristic - n. a distinguishing quality
chronic - j. being long-lasting and recurrent or characterized by long suffering
citadel - n. a stronghold into which people could go for shelter during a battle
cite - v. refer to for illustration or proof
clumsy - j. not elegant or graceful in expression
coalition - n. an organization of people (or countriesinvolved in a pact or treaty
coherent - j. marked by an orderly, logical, and aesthetically consistent relation of parts
coincidence - n. the temporal property of two things happening at the same time
collapse - v. break down, literally or metaphorically
colleague - n. an associate that one works with
collective - j. set up on the principle of collectivism or ownership and production by the workers involved usually under the supervision of a government
collector - n. a person who collects things
collision - n. an accident resulting from violent impact of a moving object
commemorate - v. mark by some ceremony or observation
commentary - n. a written explanation or criticism or illustration that is added to a book or other textual material
commission - n. a special group delegated to consider some matter
commitment - n. the act of binding yourself (intellectually or emotionallyto a course of action
commodity - n. articles of commerce
commute - n. a regular journey of some distance to and from your place of work
comparable - j. able to be compared or worthy of comparison
comparison - n. the act of examining resemblances
compassionate - j. showing or having compassion
compensate - v. make payment to; compensate
competence - n. the quality of being adequately or well qualified physically and intellectually
competent - j. properly or sufficiently qualified or capable or efficient
competitive - j. involving competition or competitiveness
competitor - n. the contestant you hope to defeat
complex - j. complicated in structure; consisting of interconnected parts
component - n. an artifact that is one of the individual parts of which a composite entity is made up; especially a part that can be separated from or attached to a system
composer - n. someone who composes music as a profession
comprehensive - j. broad in scope
concede - v. admit (to a wrongdoing)
conceive - v. have the idea for
concession - n. a point conceded or yielded
confederate - j. united in a group or league
confidence - n. a state of confident hopefulness that events will be favorable
confident - j. having or marked by confidence or assurance
confront - v. oppose, as in hostility or a competition
conscience - n. a feeling of shame when you do something immoral
conscious - j. knowing and perceiving; having awareness of surroundings and sensations and thoughts
consecutive - j. one after the other
consensus - n. agreement in the judgment or opinion reached by a group as a whole
conservatism - n. a political or theological orientation advocating the preservation of the best in society and opposing radical changes
conservative - j. avoiding excess
consistency - n. a harmonious uniformity or agreement among things or parts
conspicuous - j. obvious to the eye or mind
conspiracy - n. a plot to carry out some harmful or illegal act (especially a political plot)
constituency - n. the body of voters who elect a representative for their area
consume - v. use up (resources or materials)
consumer - n. a person who uses goods or services
consumption - n. the process of taking food into the body through the mouth
contemplate - v. look at thoughtfully; observe deep in thought
contemporary - j. belonging to the present time
contender - n. the contestant you hope to defeat
contentious - j. inclined or showing an inclination to dispute or disagree, even to engage in law suits
contingent - j. possible but not certain to occur
continuous - j. continuing in time or space without interruption
contradiction - n. opposition between two conflicting forces or ideas
contradictory - j. unable for both to be true at the same time
contribution - n. a voluntary gift (as of money or service or ideasmade to some worthwhile cause
contributor - n. someone who contributes (or promises to contributea sum of money
convenience - n. the quality of being useful and convenient
conversion - n. the act of changing from one use or function or purpose to another
convertible - j. designed to be changed from one use or form to another
conviction - n. an unshakable belief in something without need for proof or evidence
corporate - j. of or belonging to a corporation
corps - n. a body of people associated together
corruption - n. destroying someone's (or some group's) honesty or loyalty; undermining moral integrity
cosmetic - j. serving an esthetic rather than a useful purpose
cosmopolitan - j. of worldwide scope or applicability
counsel - n. something that provides direction or advice as to a decision or course of action
counterpart - n. a person or thing having the same function or characteristics as another
courageous - j. able to face and deal with danger or fear without flinching
course - n. a connected series of events or actions or developments
courtesy - n. a courteous or respectful or considerate act
credible - j. appearing to merit belief or acceptance
critique - n. a serious examination and judgment of something
crusade - v. exert oneself continuously, vigorously, or obtrusively to gain an end or engage in a crusade for a certain cause or person; be an advocate for
crush - v. to compress with violence, out of natural shape or condition
curator - n. the custodian of a collection (as a museum or library)
curriculum - n. an integrated course of academic studies
cynical - j. believing the worst of human nature and motives; having a sneering disbelief in e.g. selflessness of others
cynicism - n. a cynical feeling of distrust
daring - n. the trait of being willing to undertake things that involve risk or danger
debacle - n. a sudden and violent collapse
debut - v. appear for the first time in public
decay - n. the organic phenomenon of rotting
decency - n. the quality of conforming to standards of propriety and morality
decent - j. socially or conventionally correct; refined or virtuous
decisive - j. characterized by decision and firmness
decree - n. a legally binding command or decision entered on the court record (as if issued by a court or judge)
dedication - n. complete and wholehearted fidelity
default - n. loss due to not showing up
defendant - n. a person or institution against whom an action is brought in a court of law; the person being sued or accused
defensive - j. attempting to justify or defend in speech or writing
defiance - n. a hostile challenge
definite - j. known for certain
delicacy - n. something considered choice to eat
demise - v. transfer by a lease or by a will
demonstrate - v. establish the validity of something, as by an example, explanation or experiment
denominator - n. the divisor of a fraction
deposition - n. (lawa pretrial interrogation of a witness; usually conducted in a lawyer's office
depression - n. a long-term economic state characterized by unemployment and low prices and low levels of trade and investment
depth - n. the attribute or quality of being deep, strong, or intense
derive - v. come from
descent - n. properties attributable to your ancestry
desert - n. arid land with little or no vegetation
designate - v. give an assignment to (a personto a post, or assign a task to (a person)
despair - n. a state in which all hope is lost or absent
desperate - j. showing extreme urgency or intensity especially because of great need or desire
detect - v. discover or determine the existence, presence, or fact of
deter - v. try to prevent; show opposition to
determination - n. the quality of being determined to do or achieve something; firmness of purpose
deterrent - j. tending to deter
diagnosis - n. identifying the nature or cause of some phenomenon
dialogue - n. a discussion intended to produce an agreement
difference - n. the quality of being unlike or dissimilar
dignity - n. the quality of being worthy of esteem or respect
dilemma - n. state of uncertainty or perplexity especially as requiring a choice between equally unfavorable options
diplomacy - n. subtly skillful handling of a situation
diplomat - n. a person who deals tactfully with others
diplomatic - j. using or marked by tact in dealing with sensitive matters or people
disagree - v. be of different opinions
disappear - v. become invisible or unnoticeable
discern - v. detect with the senses
discipline - n. a system of rules of conduct or method of practice
discomfort - n. the state of being tense and feeling pain
discourse - n. extended verbal expression in speech or writing
discover - v. see for the first time; make a discovery
discriminate - v. treat differently on the basis of sex or race
discussion - n. an exchange of views on some topic
disdain - n. lack of respect accompanied by a feeling of intense dislike
dishonest - j. deceptive or fraudulent; disposed to cheat or defraud or deceive
dismal - j. causing dejection
dismay - v. fill with apprehension or alarm; cause to be unpleasantly surprised
dismissal - n. the termination of someone's employment (leaving them free to depart)
disparity - n. inequality or difference in some respect
disregard - n. willful lack of care and attention
dissent - n. a difference of opinion
distant - j. separated in space or coming from or going to a distance
distinction - n. a distinguishing difference
distress - n. extreme physical pain
distrust - v. regard as untrustworthy; regard with suspicion; have no faith or confidence in
diverse - j. many and different
diversion - n. an activity that diverts or amuses or stimulates
diversity - n. noticeable heterogeneity
divert - v. turn aside; turn away from
document - n. writing that provides information (especially information of an official nature)
doe - n. mature female of mammals of which the male is called 'buck'
domain - n. territory over which rule or control is exercised
dominance - n. the state that exists when one person or group has power over another
dominant - j. exercising influence or control
dominate - v. be in control
domination - n. social control by dominating
donate - v. give to a charity or good cause
donor - n. person who makes a gift of property
drastic - j. forceful and extreme and rigorous
drought - n. a shortage of rainfall
dubious - j. open to doubt or suspicion
dynamics - n. the branch of mechanics concerned with the forces that cause motions of bodies
earnest - j. characterized by a firm and humorless belief in the validity of your opinions
eccentric - n. a person with an unusual or odd personality
eclectic - j. selecting what seems best of various styles or ideas
editorial - n. an article giving opinions or perspectives
effect - n. a phenomenon that follows and is caused by some previous phenomenon
effective - j. works well as a means or remedy
efficiency - n. skillfulness in avoiding wasted time and effort
efficient - j. able to accomplish a purpose; functioning effectively
elaborate - v. add details, as to an account or idea; clarify the meaning of and discourse in a learned way, usually in writing
element - n. any of the more than 100 known substances (of which 92 occur naturallythat cannot be separated into simpler substances and that singly or in combination constitute all matter
eligible - j. qualified for or allowed or worthy of being chosen
eliminate - v. terminate, end, or take out
embargo - n. a government order imposing a trade barrier
emblem - n. a visible symbol representing an abstract idea
embrace - n. the act of clasping another person in the arms (as in greeting or affection)
emerge - v. come out into view, as from concealment
emergence - n. the gradual beginning or coming forth
eminent - j. of imposing height; especially standing out above others
emphasis - n. intensity or forcefulness of expression
emphasize - v. to stress, single out as important
employee - n. a worker who is hired to perform a job
employer - n. a person or firm that employs workers
emulate - v. imitate the function of (another system), as by modifying the hardware or the software
enact - v. order by virtue of superior authority; decree
encourage - v. inspire with confidence; give hope or courage to
encyclopedia - n. a reference work (often in several volumescontaining articles on various topics
endorse - v. be behind; approve of
enduring - j. patiently bearing continual wrongs or trouble
energetic - j. possessing or exerting or displaying energy
enhance - v. make better or more attractive
enormous - j. extraordinarily large in size or extent or amount or power or degree
enthusiastic - j. having or showing great excitement and interest
entity - n. that which is perceived or known or inferred to have its own distinct existence (living or nonliving)
epic - j. very imposing or impressive; surpassing the ordinary (especially in size or scale)
epidemic - n. a widespread outbreak of an infectious disease; many people are infected at the same time
episode - n. a brief section of a literary or dramatic work that forms part of a connected series
equilibrium - n. a stable situation in which forces cancel one another
equity - n. the difference between the market value of a property and the claims held against it
equivalent - j. being essentially equal to something
error - n. a wrong action attributable to bad judgment or ignorance or inattention
esquire - n. a title of respect for a member of the English gentry ranking just below a knight; placed after the name
essence - n. the central meaning or theme of a speech or literary work
evangelical - j. relating to or being a Christian church believing in personal conversion and the inerrancy of the Bible especially the Gospels
evoke - v. call to mind
evolution - n. a process in which something passes by degrees to a different stage (especially a more advanced or mature stage)
exceed - v. be greater in scope or size than some standard
excellent - j. very good; of the highest quality
excerpt - n. a passage selected from a larger work
excess - j. more than is needed, desired, or required
exclude - v. prevent from being included or considered or accepted
excursion - n. a journey taken for pleasure
exempt - v. grant relief or an exemption from a rule or requirement to
existence - n. everything that exists anywhere
exit - v. move out of or depart from
exotic - j. strikingly strange or unusual
expand - v. become larger in size or volume or quantity
expansion - n. the act of increasing (somethingin size or volume or quantity or scope
expect - v. regard something as probable or likely
expectancy - n. something expected (as on the basis of a norm)
expense - n. money spent to perform work and usually reimbursed by an employer
expertise - n. skillfulness by virtue of possessing special knowledge
explicit - j. precisely and clearly expressed or readily observable; leaving nothing to implication
explode - v. drive from the stage by noisy disapproval
exploit - v. use or manipulate to one's advantage
explosion - n. the act of exploding or bursting
explosive - n. a chemical substance that undergoes a rapid chemical change (with the production of gason being heated or struck
exposure - n. vulnerability to the elements; to the action of heat or cold or wind or rain
expressive - j. characterized by expression
extension - n. an addition to the length of something
extensive - j. large in spatial extent or range or scope or quantity
exterior - n. the outer side or surface of something
external - j. happening or arising or located outside or beyond some limits or especially surface
extradition - n. the surrender of an accused or convicted person by one state or country to another (usually under the provisions of a statute or treaty)
extraordinary - j. beyond what is ordinary or usual; highly unusual or exceptional or remarkable
extravagant - j. unrestrained, especially with regard to feelings
exuberant - j. joyously unrestrained
fabulous - j. extremely pleasing
facial - j. of or concerning the face
facility - n. something designed and created to serve a particular function and to afford a particular convenience or service
faction - n. a dissenting clique
faulty - j. characterized by errors; not agreeing with a model or not following established rules
feasible - j. capable of being done with means at hand and circumstances as they are
felony - n. a serious crime (such as murder or arson)
feminine - j. associated with women and not with men
fervor - n. the state of being emotionally aroused and worked up
fetus - n. an unborn or unhatched vertebrate in the later stages of development showing the main recognizable features of the mature animal
feud - n. a bitter quarrel between two parties
feudal - j. of or relating to or characteristic of feudalism
fidelity - n. the quality of being faithful
finale - n. the concluding part of any performance
finite - j. bounded or limited in magnitude or spatial or temporal extent
fiscal - j. involving financial matters
flag - n. emblem usually consisting of a rectangular piece of cloth of distinctive design
flamboyant - j. marked by ostentation but often tasteless
fleet - n. a group of warships organized as a tactical unit
flexible - j. able to flex; able to bend easily
flop - n. a complete failure
flourish - n. a showy gesture
foil - n. anything that serves by contrast to call attention to another thing's good qualities
ford - v. cross a river where it's shallow
forecast - n. a prediction about how something (as the weatherwill develop
foreign - j. relating to or originating in or characteristic of another place or part of the world
foresee - v. act in advance of; deal with ahead of time
formation - n. an arrangement of people or things acting as a unit
formidable - j. extremely impressive in strength or excellence
formula - n. directions for making something
forte - n. an asset of special worth or utility
forth - a. forward in time or order or degree
foster - v. promote the growth of
fragile - j. easily broken or damaged or destroyed
frantic - j. excessively agitated; distraught with fear or other violent emotion
fray - v. wear away by rubbing
frequency - n. the number of occurrences within a given time period
fringe - n. a social group holding marginal or extreme views
frivolous - j. not serious in content or attitude or behavior
frontier - n. a wilderness at the edge of a settled area of a country
fundamental - j. being or involving basic facts or principles
further - v. promote the growth of
futile - j. producing no result or effect
galaxy - n. (astronomya collection of star systems; any of the billions of systems each having many stars and nebulae and dust
gamble - v. take a risk in the hope of a favorable outcome
gauge - n. a measuring instrument for measuring and indicating a quantity such as the thickness of wire or the amount of rain etc.
generate - v. bring into existence
generic - j. applicable to an entire class or group
generosity - n. the trait of being willing to give your money or time
genesis - n. the first book of the Old Testament: tells of Creation; Adam and Eve; Cain and Abel
gesture - n. motion of hands or body to emphasize or help to express a thought or feeling
gigantic - j. so exceedingly large or extensive as to suggest a giant or mammoth
gist - n. the choicest or most essential or most vital part of some idea or experience
glimpse - n. a brief or incomplete view
glorious - j. having great beauty and splendor
grandeur - n. the quality of being magnificent or splendid or grand
grandiose - j. impressive because of unnecessary largeness or grandeur; used to show disapproval
grave - j. of great gravity or crucial import; requiring serious thought
gravity - n. a manner that is serious and solemn
grief - n. something that causes great unhappiness
grotesque - j. distorted and unnatural in shape or size; abnormal and hideous
grove - n. a small growth of trees without underbrush
guise - n. an artful or simulated semblance
hack - n. a mediocre and disdained writer
hale - j. exhibiting or restored to vigorous good health
handwriting - n. something written by hand
harbor - v. hold back a thought or feeling about
hazard - n. a source of danger; a possibility of incurring loss or misfortune
heir - n. a person who is entitled by law or by the terms of a will to inherit the estate of another
heritage - n. practices that are handed down from the past by tradition
hilarious - j. marked by or causing boisterous merriment or convulsive laughter
hollow - j. not solid; having a space or gap or cavity
homage - n. respectful deference
hostility - n. violent action that is hostile and usually unprovoked
humane - j. marked or motivated by concern with the alleviation of suffering
humanitarian - n. someone devoted to the promotion of human welfare and to social reforms
hush - v. become quiet or still; fall silent
hybrid - n. (geneticsan organism that is the offspring of genetically dissimilar parents or stock; especially offspring produced by breeding plants or animals of different varieties or breeds or species
hypocrisy - n. insincerity by virtue of pretending to have qualities or beliefs that you do not really have
hypothesis - n. a tentative insight into the natural world; a concept that is not yet verified but that if true would explain certain facts or phenomena
hysteria - n. excessive or uncontrollable fear
icon - n. a conventional religious painting in oil on a small wooden panel; venerated in the Eastern Church
ideology - n. an orientation that characterizes the thinking of a group or nation
illusion - n. an erroneous mental representation
imaginary - j. not based on fact; unreal
imitation - n. something copied or derived from an original
immense - j. unusually great in size or amount or degree or especially extent or scope
immigrant - n. a person who comes to a country where they were not born in order to settle there
imminent - j. close in time; about to occur
immoral - j. not adhering to ethical or moral principles
immune - j. (usually followed by 'to') not affected by a given influence
impending - j. close in time; about to occur
implausible - j. having a quality that provokes disbelief
implicit - j. implied though not directly expressed; inherent in the nature of something
imply - v. express or state indirectly
impose - v. compel to behave in a certain way
improper - j. not suitable or right or appropriate
impulse - n. a sudden desire
inadequate - j. not sufficient to meet a need
incentive - n. a positive motivational influence
incidence - n. the relative frequency of occurrence of something
incident - n. a public disturbance
incidentally - a. of a minor or subordinate nature
inclined - j. at an angle to the horizontal or vertical position
incompetence - n. lack of physical or intellectual ability or qualifications
inconsistent - j. displaying a lack of consistency
inconvenient - j. not suited to your comfort, purpose or needs
indefinitely - a. to an indefinite extent; for an indefinite time
indicator - n. a device for showing the operating condition of some system
indifferent - j. showing no care or concern in attitude or action
indigenous - j. originating where it is found
indulge - v. enjoy to excess
inefficient - j. not producing desired results; wasteful
inept - j. generally incompetent and ineffectual
inevitable - j. incapable of being avoided or prevented
inexpensive - j. relatively low in price or charging low prices
infamous - j. known widely and usually unfavorably
infinite - j. having no limits or boundaries in time or space or extent or magnitude
influence - n. a power to affect persons or events especially power based on prestige etc
influential - j. having or exercising influence or power
influx - n. the process of flowing in
ingenious - j. showing inventiveness and skill
inherent - j. in the nature of something though not readily apparent
injunction - n. (lawa judicial remedy issued in order to prohibit a party from doing or continuing to do a certain activity
inland - a. towards or into the interior of a region
insight - n. the clear (and often suddenunderstanding of a complex situation
insistence - n. the state of demanding notice or attention
inspector - n. a high ranking police officer
instance - n. an occurrence of something
instant - n. a very short time
insufficient - j. of a quantity not able to fulfill a need or requirement
integral - j. essential to completeness; lacking nothing
integrity - n. moral soundness
intellectual - j. appealing to or using the intellect
intelligence - n. the ability to comprehend; to understand and profit from experience
intensive - j. characterized by a high degree or intensity; often used as a combining form
intention - n. an act of intending; a volition that you intend to carry out
interact - v. act together or towards others or with others
interim - n. the time between one event, process, or period and another
intermediate - j. lying between two extremes in time or space or state
intervene - v. get involved, so as to alter or hinder an action, or through force or threat of force
intervention - n. the act of intervening (as to mediate a dispute, etc.)
intimacy - n. close or warm friendship
intricate - j. having many complexly arranged elements; elaborate
invasion - n. any entry into an area not previously occupied
inventive - j. (used of persons or artifactsmarked by independence and creativity in thought or action
investigator - n. a police officer who investigates crimes
investor - n. someone who commits capital in order to gain financial returns
invincible - j. incapable of being overcome or subdued
invoke - v. cite as an authority; resort to
involuntary - j. not subject to the control of the will
involve - v. engage as a participant
irony - n. incongruity between what might be expected and what actually occurs
irrational - j. not consistent with or using reason
irrelevant - j. having no bearing on or connection with the subject at issue
irresistible - j. impossible to resist; overpowering
irresponsible - j. showing lack of care for consequences
judgment - n. the capacity to assess situations or circumstances shrewdly and to draw sound conclusions
judicial - j. belonging or appropriate to the office of a judge
juicy - j. lucrative
junction - n. something that joins or connects
jurisdiction - n. (lawthe right and power to interpret and apply the law
juror - n. someone who serves (or waits to be called to serveon a jury
justification - n. something (such as a fact or circumstancethat shows an action to be reasonable or necessary
juvenile - j. of or relating to or characteristic of or appropriate for children or young people
ken - n. range of what one can know or understand
knight - n. originally a person of noble birth trained to arms and chivalry; today in Great Britain a person honored by the sovereign for personal merit
knit - n. needlework created by interlacing yarn in a series of connected loops using straight eyeless needles or by machine
lament - v. regret strongly
landmark - n. the position of a prominent or well-known object in a particular landscape
landscape - n. an expanse of scenery that can be seen in a single view
lapse - n. a break or intermission in the occurrence of something
laureate - n. someone honored for great achievements; figuratively someone crowned with a laurel wreath
lavish - j. very generous
lax - j. lacking in rigor or strictness
legacy - n. (lawa gift of personal property by will
legislative - j. relating to a legislature or composed of members of a legislature
legitimacy - n. lawfulness by virtue of being authorized or in accordance with law
legitimate - j. in accordance with recognized or accepted standards or principles
leisure - n. time available for ease and relaxation
lenient - j. not strict
levy - v. impose and collect
liable - j. held legally responsible
liberalism - n. a political orientation that favors social progress by reform and by changing laws rather than by revolution
lifelong - j. continuing through life
lifetime - n. the period during which something is functional (as between birth and death)
likelihood - n. the probability of a specified outcome
liking - n. a feeling of pleasure and enjoyment
liquor - n. an alcoholic beverage that is distilled rather than fermented
literacy - n. the ability to read and write
literal - j. avoiding embellishment or exaggeration (used for emphasis)
literature - n. creative writing of recognized artistic value
logic - n. the principles that guide reasoning within a given field or situation
logical - j. capable of thinking and expressing yourself in a clear and consistent manner
lovable - j. having characteristics that attract love or affection
lucrative - j. producing a sizeable profit
ludicrous - j. broadly or extravagantly humorous; resembling farce
lying - n. the deliberate act of deviating from the truth
machinery - n. machines or machine systems collectively
magnet - n. (physicsa device that attracts iron and produces a magnetic field
magnificent - j. characterized by grandeur
magnitude - n. the property of relative size or extent (whether large or small)
maintain - v. state or assert
maintenance - n. activity involved in maintaining something in good working order
makeup - n. the way in which someone or something is composed
mandate - n. an authorization to act given to a representative
mandatory - j. required by rule
maneuver - v. act in order to achieve a certain goal
manifesto - n. a public declaration of intentions (as issued by a political party or government)
marine - j. native to or inhabiting the sea
maritime - j. relating to or involving ships or shipping or navigation or seamen
martial - j. suggesting war or military life
marvel - v. be amazed at
massacre - n. the savage and excessive killing of many people
massive - j. imposing in size or bulk or solidity
masterpiece - n. the most outstanding work of a creative artist or craftsman
material - j. concerned with worldly rather than spiritual interests
maternal - j. relating to or derived from one's mother
maze - n. complex system of paths or tunnels in which it is easy to get lost
mechanics - n. the technical aspects of doing something
medicine - n. something that treats or prevents or alleviates the symptoms of disease
medieval - j. as if belonging to the Middle Ages; old-fashioned and unenlightened
mediocre - j. moderate to inferior in quality
meditation - n. continuous and profound contemplation or musing on a subject or series of subjects of a deep or abstruse nature
melodrama - n. an extravagant comedy in which action is more salient than characterization
memorable - j. worth remembering
menace - v. act in a threatening manner
mentality - n. a habitual or characteristic mental attitude that determines how you will interpret and respond to situations
mentor - v. serve as a teacher or trusted counselor
metal - n. any of several chemical elements that are usually shiny solids
metaphor - n. a figure of speech in which an expression is used to refer to something that it does not literally denote in order to suggest a similarity
metric - j. based on the meter as a standard of measurement
metropolis - n. a large and densely populated urban area; may include several independent administrative districts
metropolitan - j. relating to or characteristic of a densely populated urban area
mileage - n. the ratio of the number of miles traveled to the number of gallons of gasoline burned; miles per gallon
militant - j. disposed to warfare or hard-line policies
militia - n. civilians trained as soldiers but not part of the regular army
miniature - j. being on a very small scale
minimize - v. make small or insignificant
ministry - n. a government department under the direction of a minister
minority - n. being or relating to the smaller in number of two parts
minute - j. infinitely or immeasurably small
misdemeanor - n. a crime less serious than a felony
missile - n. a rocket carrying a warhead of conventional or nuclear explosives
momentum - n. an impelling force or strength
monarchy - n. an autocracy governed by a monarch who usually inherits the authority
monastery - n. the residence of a religious community
monetary - j. relating to or involving money
monopoly - n. (economicsa market in which there are many buyers but only one seller
morale - n. the spirit of a group that makes the members want the group to succeed
morality - n. concern with the distinction between good and evil or right and wrong; right or good conduct
motto - n. a favorite saying of a sect or political group
mundane - j. concerned with the world or worldly matters; ordinary
municipal - j. relating to city government
muster - v. gather or bring together
myriad - n. a large indefinite number
myth - n. a traditional story accepted as history; serves to explain the world view of a people
mythology - n. myths collectively; the body of stories associated with a culture or institution or person
narrative - n. a message that tells the particulars of an act or occurrence or course of events; presented in writing or drama or cinema or as a radio or television program
narrator - n. someone who tells a story
naturally - a. according to nature; by natural means; without artificial help
naval - j. connected with or belonging to or used in a navy
necessary - j. absolutely essential
necessity - n. anything indispensable
network - n. an interconnected system of things or people
neutral - j. having no personal preference
nevertheless - a. despite anything to the contrary (usually following a concession)
noisy - j. full of or characterized by loud and nonmusical sounds
nomination - n. the condition of having been proposed as a suitable candidate for appointment or election
nominee - n. a politician who is running for public office
norm - n. a standard or model or pattern regarded as typical
notorious - j. known widely and usually unfavorably
nude - n. without clothing (especially in the phrase 'in the nude')
obesity - n. more than average fatness
objective - j. undistorted by emotion or personal bias; based on observable phenomena
observatory - n. a building designed and equipped to observe astronomical phenomena
obsolete - j. no longer in use
obstruction - n. something that stands in the way and must be circumvented or surmounted
obtain - v. come into possession of
occasion - n. a vaguely specified social event
odor - n. the sensation that results when olfactory receptors in the nose are stimulated by particular chemicals in gaseous form
ominous - j. threatening or foreshadowing evil or tragic developments
operate - v. handle and cause to function
operator - n. an agent that operates some apparatus or machine
opinion - n. a personal belief or judgment that is not founded on proof or certainty
opponent - n. a contestant that you are matched against
opportunity - n. a possibility due to a favorable combination of circumstances
optimism - n. a general disposition to expect the best in all things
option - n. one of a number of things from which only one can be chosen
oral - j. of or relating to or affecting or for use in the mouth
ordeal - n. a severe or trying experience
ornate - j. marked by elaborate rhetoric and elaborated with decorative details
orthodox - j. adhering to what is commonly accepted
outbreak - n. a sudden violent spontaneous occurrence (usually of some undesirable condition)
outcry - n. a loud utterance; often in protest or opposition
outrage - n. a feeling of righteous anger
outrageous - j. grossly offensive to decency or morality; causing horror
outright - a. without reservation or concealment
overhaul - v. make repairs, renovations, revisions or adjustments to
oversee - v. watch and direct
overthrow - n. the termination of a ruler or institution (especially by force)
overweight - n. the property of excessive fatness
pact - n. a written agreement between two states or sovereigns
pageant - n. a rich and spectacular ceremony
panic - n. an overwhelming feeling of fear and anxiety
pantheon - n. all the gods of a religion
paradox - n. (logica statement that contradicts itself
parallel - j. being everywhere equidistant and not intersecting
parish - n. a local church community
parliament - n. a legislative assembly in certain countries
parody - v. make a spoof of or make fun of
participant - n. someone who takes part in an activity
participate - v. become a participant; be involved in
partisan - n. an ardent and enthusiastic supporter of some person or activity
partition - v. divide into parts, pieces, or sections
passive - j. lacking in energy or will
patriotism - n. love of country and willingness to sacrifice for it
patron - n. someone who supports or champions something
pavilion - n. large and often sumptuous tent
peaceful - j. not disturbed by strife or turmoil or war
pedestrian - j. lacking wit or imagination
penalty - n. a punishment for a crime or offense
penchant - n. a strong liking
pennant - n. a long flag; often tapering
pension - n. a regular payment to a person that is intended to allow them to subsist without working
pentagon - n. a five-sided polygon
perceive - v. to become aware of or conscious of
perception - n. becoming aware of something via the senses
perennial - j. lasting an indefinitely long time; suggesting self-renewal
perform - v. carry out or perform an action
perjury - n. criminal offense of making false statements under oath
permanent - j. continuing or enduring without marked change in status or condition or place
perpetual - j. continuing forever or indefinitely
persist - v. be persistent, refuse to stop
personal - j. concerning or affecting a particular person or his or her private life and personality
personality - n. the complex of all the attributes--behavioral, temperamental, emotional and mental--that characterize a unique individual
personnel - n. persons collectively in the employ of a business
perspective - n. the appearance of things relative to one another as determined by their distance from the viewer
persuade - v. cause somebody to adopt a certain position, belief, or course of action; twist somebody's arm
pervasive - j. spreading or spread throughout
petty - j. contemptibly narrow in outlook
phenomenal - j. exceedingly or unbelievably great
phenomenon - n. any state or process known through the senses rather than by intuition or reasoning
philharmonic - j. composing or characteristic of an orchestral group
philosophy - n. any personal belief about how to live or how to deal with a situation
physicist - n. a scientist trained in physics
physics - n. the science of matter and energy and their interactions
pinch - n. a squeeze with the fingers
pine - n. straight-grained white to yellowish tree
pioneer - v. open up and explore a new area
pivotal - j. being of crucial importance
plausible - j. apparently reasonable and valid, and truthful
playful - j. full of fun and high spirits
playwright - n. someone who writes plays
plea - n. a humble request for help from someone in authority
plead - v. appeal or request earnestly
pleasant - j. affording pleasure; being in harmony with your taste or likings
plunge - v. fall abruptly
poetic - j. of or relating to poetry
poignant - j. arousing emotions; touching
poised - j. in full control of your faculties
portfolio - n. a set of pieces of creative work collected to be shown to potential customers or employers
positive - j. characterized by or displaying affirmation or acceptance or certainty etc.
possess - v. have as an attribute, knowledge, or skill
possession - n. the act of having and controlling property
potent - j. having a strong physiological or chemical effect
potential - j. existing in possibility
precedent - n. an example that is used to justify similar occurrences at a later time
precise - j. sharply exact or accurate or delimited
precision - n. the quality of being reproducible in amount or performance
predecessor - n. one who precedes you in time (as in holding a position or office)
predict - v. make a prediction about; tell in advance
prediction - n. a statement made about the future
prefer - v. like better; value more highly
preference - n. a strong liking
prejudice - n. a partiality that prevents objective consideration of an issue or situation
premature - j. too soon or too hasty
premier - v. be performed for the first time
premise - v. set forth beforehand, often as an explanation
preparation - n. the activity of putting or setting in order in advance of some act or purpose
preposterous - j. incongruous; inviting ridicule
prescription - n. written instructions from a physician or dentist to a druggist concerning the form and dosage of a drug to be issued to a given patient
preservation - n. the activity of protecting something from loss or danger
pretentious - j. making claim to or creating an appearance of (often undeservedimportance or distinction
prevalent - j. most frequent or common
prevention - n. the act of preventing
primer - n. an introductory textbook
primitive - j. belonging to an early stage of technical development; characterized by simplicity and (oftencrudeness
principal - n. the educator who has executive authority for a school
principle - n. a basic truth or law or assumption
principled - j. based on or manifesting objectively defined standards of rightness or morality
pristine - j. completely free from dirt or contamination
privilege - n. a special advantage or immunity or benefit not enjoyed by all
probation - n. (lawa way of dealing with offenders without imprisoning them; a defendant found guilty of a crime is released by the court without imprisonment subject to conditions imposed by the court
probe - v. question or examine thoroughly and closely
procedure - n. a process or series of acts especially of a practical or mechanical nature involved in a particular form of work
proceed - v. move ahead; travel onward in time or space
productive - j. producing or capable of producing (especially abundantly)
profession - n. an occupation requiring special education (especially in the liberal arts or sciences)
professor - n. someone who is a member of the faculty at a college or university
profile - n. an outline of something (especially a human face as seen from one side)
progressive - j. favoring or promoting progress
prohibition - n. the action of prohibiting or inhibiting or forbidding (or an instance thereof)
prolific - j. bearing in abundance especially offspring
promenade - n. a public area set aside as a pedestrian walk
prominence - n. relative importance
prominent - j. having a quality that thrusts itself into attention
promoter - n. someone who is an active supporter and advocate
prone - j. having a tendency (to); often used in combination
propaganda - n. information that is spread for the purpose of promoting some cause
prophet - n. someone who speaks by divine inspiration; someone who is an interpreter of the will of God
protagonist - n. the principal character in a work of fiction
protection - n. the activity of protecting someone or something
protective - j. intended or adapted to afford protection of some kind
protestant - j. of or relating to Protestants or Protestantism
provincial - j. characteristic of the provinces or their people
provoke - v. evoke or provoke to appear or occur
proxy - n. a person authorized to act for another
prudence - n. knowing how to avoid embarrassment or distress
psychic - j. outside the sphere of physical science
pundit - n. someone who has been admitted to membership in a scholarly field
quake - v. shake with fast, tremulous movements
qualify - v. make fit or prepared
quarterly - a. in three month intervals
radical - j. markedly new or introducing extreme change
rampant - j. unrestrained and violent
rapid - j. characterized by speed; moving with or capable of moving with high speed
rave - v. praise enthusiastically
reaction - n. a response that reveals a person's feelings or attitude
readily - a. without much difficulty
realism - n. the attribute of accepting the facts of life and favoring practicality and literal truth
recipient - n. a person who receives something
reckless - j. characterized by careless unconcern
recognize - v. detect with the senses
reconcile - v. come to terms
reconsider - v. consider again; give new consideration to; usually with a view to changing
recover - v. get or find back; recover the use of
recruit - v. cause to assemble or enlist in the military
redemption - n. (theologythe act of delivering from sin or saving from evil
refer - v. send or direct for treatment, information, or a decision
reflection - n. the image of something as reflected by a mirror (or other reflective material)
reform - v. make changes for improvement in order to remove abuse and injustices
refuge - n. a shelter from danger or hardship
refusal - n. the act of not accepting something that is offered
regime - n. the government or governing authority of a political unit
regional - j. related or limited to a particular region
reign - v. have sovereign power
relevant - j. having a bearing on or connection with the subject at issue
reliant - j. depending on another for support
reluctance - n. a certain degree of unwillingness
reluctant - j. not eager
reminiscent - j. serving to bring to mind
renaissance - n. the period of European history at the close of the Middle Ages and the rise of the modern world; a cultural rebirth from the 14th through the middle of the 17th centuries
render - v. give or supply
renowned - j. widely known and esteemed
repeal - n. cancel officially
reproduction - n. the act of making copies
requisite - n. anything indispensable
resemblance - n. similarity in appearance or external or superficial details
resent - v. feel bitter or indignant about
resist - v. withstand the force of something
resistance - n. the action of opposing something that you disapprove or disagree with
resistant - j. impervious to being affected
resort - v. have recourse to
resource - n. a source of aid or support that may be drawn upon when needed
restore - v. bring back into original existence, use, function, or position
resurrection - n. (New Testamentthe rising of Christ on the third day after the Crucifixion
retrospect - n. contemplation of things past
retrospective - j. concerned with or related to the past
revelation - n. communication of knowledge to man by a divine or supernatural agency
revive - v. be brought back to life, consciousness, or strength
rhetoric - n. using language effectively to please or persuade
ridiculous - j. incongruous; absurd; nonsensical
rigorous - j. demanding strict attention to rules and procedures
robust - j. sturdy and strong in form, constitution, or construction
rue - n. sadness associated with some wrong done or some disappointment
rural - j. living in or characteristic of farming or country life
rustic - j. characteristic of the fields or country
sacrifice - v. kill or destroy
savage - v. criticize harshly or violently
scholarly - j. characteristic of learning or studying
scope - n. an area in which something acts or operates or has power or control
script - n. a written version of a play or other dramatic composition; used in preparing for a performance
secession - n. formal separation from an alliance or federation
secondary - j. not of major importance
secrecy - n. the trait of keeping things secret
secular - j. not concerned with or devoted to religion
seize - v. take hold of; grab
selective - j. characterized by very careful or fastidious choices
seminar - n. any meeting for an exchange of ideas
sensation - n. a perception associated with stimulation of a sensory organ
sensibility - n. refined sensitivity to pleasurable or painful impressions
sensitive - j. responsive to physical stimuli
sentence - n. the period of time a prisoner is imprisoned
sentinel - n. a person employed to keep watch for some anticipated event
sequel - n. a part added to a book or play that continues and extends it
sequence - n. serial arrangement in which things follow in logical order or a recurrent pattern
sergeant - n. any of several noncommissioned officer ranks in the Army or Air Force or Marines ranking above a corporal
servitude - n. state of subjection to an owner or master or forced labor imposed as punishment
severely - a. with sternness; in a severe manner
shallow - j. lacking depth of intellect or knowledge; concerned only with what is obvious
sheer - j. complete and without restriction or qualification
shrewd - j. marked by practical hardheaded intelligence
siege - n. the action of an armed force that surrounds a fortified place and isolates it while continuing to attack
significance - n. the quality of being important in effect or meaning
significant - j. important in effect or meaning
similar - j. having close to the same characteristics
sinister - j. stemming from evil characteristics or forces; wicked or dishonorable
skepticism - n. the disbelief in any claims of ultimate knowledge
slack - j. not tense or taut
slight - n. a deliberate discourteous act (usually as an expression of anger or disapproval)
sober - v. become more realistic
socialism - n. a political theory advocating state ownership of industry
socialist - j. advocating or following the socialist principles of state ownership
sociology - n. the study and classification of human societies
solar - j. relating to or derived from the sun or utilizing the energies of the sun
soldier - n. an enlisted man or woman who serves in an army
somber - j. grave or even gloomy in character
sophisticated - j. having or appealing to those having worldly knowledge and refinement
souvenir - n. a reminder of past events
specialty - n. an asset of special worth or utility
species - n. (biologytaxonomic group whose members can interbreed
spectator - n. a close observer; someone who looks at something (such as an exhibition of some kind)
specter - n. a ghostly appearing figure
spectrum - n. a broad range of related objects or ideas or activities
speculate - v. consider in an idle or casual way and with an element of doubt or without sufficient reason to reach a conclusion
spontaneous - j. said or done without having been planned or written in advance
static - j. showing little if any change
stature - n. high level of respect gained by impressive development or achievement
statute - n. an act passed by a legislative body
stealth - n. avoiding detection by moving carefully
stimulate - v. cause to be alert and energetic
stringent - j. demanding strict attention to rules and procedures
submission - n. something (manuscripts or architectural plans and models or estimates or works of art of all genres etc.submitted for the judgment of others (as in a competition)
subsequent - j. following in time or order
subsidiary - j. functioning in a supporting capacity
substantive - j. having a firm basis in reality and being therefore important, meaningful, or considerable
subtle - j.  difficult to detect or grasp by the mind or analyze
successor - n. a person who follows next in order
summary - n. a brief statement that presents the main points in a concise form
superb - j. of surpassing excellence
superficial - j. concerned with or comprehending only what is apparent or obvious; not deep or penetrating emotionally or intellectually
suppress - v. reduce the incidence or severity of or stop
surround - v. extend on all sides of simultaneously; encircle
suspense - n. excited anticipation of an approaching climax
suspension - n. an interruption in the intensity or amount of something
suspicious - j. openly distrustful and unwilling to confide
sympathetic - j. expressing or feeling or resulting from sympathy or compassion or friendly fellow feelings; disposed toward
symphony - n. a large orchestra; can perform symphonies
systematic - j. characterized by order and planning
tactics - n. the branch of military science dealing with detailed maneuvers to achieve objectives set by strategy
tangible - j. perceptible by the senses especially the sense of touch
taxation - n. the imposition of taxes; the practice of the government in levying taxes on the subjects of a state
technique - n. skillfulness in the command of fundamentals deriving from practice and familiarity
technology - n. the practical application of science to commerce or industry
telescope - n. a magnifier of images of distant objects
temporary - j. not permanent; not lasting
tendency - n. a characteristic likelihood of or natural disposition toward a certain condition or character or effect
tense - j. taut or rigid; stretched tight
tentative - j. unsettled in mind or opinion
tenure - v. give life-time employment to
terminal - j. being or situated at an end
territorial - j. displaying territoriality; defending an area from intruders
testament - n. a profession of belief
theological - j. of or relating to or concerning the study of religion
theology - n. the rational and systematic study of religion and its influences and of the nature of religious truth
theoretical - j. concerned with theories rather than their practical applications
theorist - n. someone who theorizes (especially in science or art)
thesis - n. a formal paper advancing a new point of view resulting from research; usually a requirement for an advanced academic degree
titanic - j. of great force or power
tolerance - n. willingness to recognize and respect the beliefs or practices of others
tolerant - j. showing respect for the rights or opinions or practices of others
tolerate - v. recognize and respect (rights and beliefs of others)
transcript - n. something that has been transcribed; a written record (usually typewrittenof dictated or recorded speech
transfer - v. move from one place to another
transition - v. make or undergo a transition (from one state or system to another)
translate - v. restate (wordsfrom one language into another language
transmission - n. the act of sending a message; causing a message to be transmitted
transparent - j. transmitting light; able to be seen through with clarity
transplant - n. the act of removing something from one location and introducing it in another location
tremendous - j. extraordinarily large in size or extent or amount or power or degree
tribune - n. a protector of the people
trinity - n. the union of the Father and Son and Holy Ghost in one Godhead
triple - v. increase threefold
trivial - j. of little substance or significance
truthful - j. expressing or given to expressing the truth
turmoil - n. a violent disturbance
typical - j. exhibiting the qualities or characteristics that identify a group or kind or category
ubiquitous - j. being present everywhere at once
ultimate - j. furthest or highest in degree or order; utmost or extreme
unanimous - j. acting together as a single undiversified whole
uncommon - j. not common or ordinarily encountered; unusually great in amount or remarkable in character or kind
unconscious - j. not conscious; lacking awareness and the capacity for sensory perception as if asleep or dead
undermine - v. destroy property or hinder normal operations
unique - j. the single one of its kind
unlimited - j. having no limits in range or scope
unprecedented - j. having no previous example; novel
urban - j. located in or characteristic of a city or city life
urgency - n. an urgent situation calling for prompt action
usage - n. the act of using
utility - n. the quality of being of practical use
vacuum - n. a region that is devoid of matter
valid - j. well grounded in logic or truth or having legal force
variation - n. an artifact that deviates from a norm or standard
vegetarian - n. eater of fruits and grains and nuts; someone who eats no meat or fish or (oftenany animal products
vegetation - n. all the plant life in a particular region or period
venerable - j. impressive by reason of age
verify - v. confirm the truth of
version - n. something a little different from others of the same type
vertical - j. at right angles to the plane of the horizon or a base line
veto - n. the power or right to prohibit or reject a proposed or intended act (especially the power of a chief executive to reject a bill passed by the legislature)
vigorous - j. strong and active physically or mentally
violation - n. an act that disregards an agreement or a right
vista - n. the visual percept of a region
visual - j. relating to or using sight
vitality - n. an energetic style
vogue - n. the popular taste at a given time
volatile - j. liable to lead to sudden change or violence
vulnerable - j. capable of being wounded or hurt
warrant - v. stand behind and guarantee the quality, accuracy, or condition of
wherever - a. where in the world
wholly - a. to a complete degree or to the full or entire extent ('whole' is often used informally for 'wholly')
woo - v. seek someone's favor
zeal - n. excessive fervor to do something or accomplish some end



//
//res\values\strings.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2010, 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.
*/
-->
<resources>

    <!-- The name of the application. -->
    <string name="app_name">Searchable Dictionary</string>

    <!-- The label for use as a searchable item -->
    <string name="search_label">Dictionary</string>

    <!-- The hint text that appears in the search box. -->
    <string name="search_hint">Search the dictionary</string>

    <!-- The menu entry that invokes search. -->
    <string name="menu_search">Search</string>

    <!-- The description that will show up in the search settings for this source.  -->
    <string name="settings_description">Definitions of words</string>

    <!-- General instructions in the main activity. -->
    <string name="search_instructions">Use the search box in the Action Bar to look up a word</string>

    <!-- Shown above search results when we receive a search request. -->
    <plurals name="search_results">
      <item quantity="one">%1$d result for \"%2$s\": </item>
      <item quantity="other">%1$d results for \"%2$s\": </item>
    </plurals>

    <!-- Search failure message. -->
    <string name="no_results">No results found for \"%s\"</string>

</resources>



//
//res\xml\searchable.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2010, 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.
*/
-->

<!-- The attributes below configure the Android search box appearance
     and the search suggestions settings.
     See the Developer Guide for more information
     http://developer.android.com/guide/topics/search/
 -->
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
        android:label="@string/search_label"
        android:hint="@string/search_hint"
        android:searchSettingsDescription="@string/settings_description"
        android:searchSuggestAuthority="com.example.android.searchabledict.DictionaryProvider"
        android:searchSuggestIntentAction="android.intent.action.VIEW"
        android:searchSuggestIntentData="content://com.example.android.searchabledict.DictionaryProvider/dictionary"
        android:searchSuggestSelection=" ?"
        android:searchSuggestThreshold="1"
        android:includeInGlobalSearch="true"
        >
 </searchable>
 
 
 
 
 
 
 


 


 

3 comments:

  1. I agree with you there @Dan even though I am in the process of updating my post with a very stripped down version of what I have. It's a shame that the principles aren't the same between server response with JSONObjects and local storage/SQLite

    ReplyDelete
  2. Thank you sir... It is working that way perfect

    ReplyDelete

Followers