public static void showToast(final Activity activity, final String word, final long time){
activity.runOnUiThread(new Runnable() {
public void run() {
final Toast toast = Toast.makeText(activity, word, Toast.LENGTH_LONG);
toast.show();
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
toast.cancel();
}
}, time);
}
});
}