Example usage for android.widget Toast show

List of usage examples for android.widget Toast show

Introduction

In this page you can find the example usage for android.widget Toast show.

Prototype

public void show() 

Source Link

Document

Show the view for the specified duration.

Usage

From source file:com.urucas.plugins.ToastPlugin.java

private void alert(String text, String duration, CallbackContext callbackContext) {

    Context context = this.cordova.getActivity();

    int duration1;
    if (duration.toLowerCase().equals("long")) {
        duration1 = Toast.LENGTH_LONG;//from  w  ww  .  ja v  a  2 s  . c o m
    } else {
        duration1 = Toast.LENGTH_SHORT;
    }
    Toast toast = Toast.makeText(context, text, duration1);
    toast.show();
}

From source file:fr.cph.stock.android.StockTrackerApp.java

/**
 * This function toast a toast "updated" message to the screen
 *//*from   w  w w  .  java2 s.c o m*/
public void toast() {
    Context context = getApplicationContext();
    CharSequence text = "Updated !";
    int duration = Toast.LENGTH_LONG;
    Toast toast = Toast.makeText(context, text, duration);
    toast.show();
}

From source file:com.bbxiaoqu.api.util.Utils.java

public static void makeEventToast(Context context, String text, boolean isLongToast) {

    Toast toast = null;
    if (isLongToast) {
        toast = Toast.makeText(context, "", Toast.LENGTH_LONG);
    } else {/*  ww w .  j  a va2  s  .c o  m*/
        toast = Toast.makeText(context, "", Toast.LENGTH_SHORT);
    }
    View v = LayoutInflater.from(context).inflate(R.layout.toast_view, null);
    TextView textView = (TextView) v.findViewById(R.id.text);
    textView.setText(text);
    toast.setView(v);
    toast.show();
}

From source file:com.orange.labs.sample.UploadPicture.java

private void showToast(String msg) {
    Toast error = Toast.makeText(mContext, msg, Toast.LENGTH_LONG);
    error.show();
}

From source file:eltharis.wsn.showIDActivity.java

/**
 * Called when the activity is first created.
 *///  w  ww  .j  av a2 s  .  c o m
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.showid_layout);
    int id = getIntent().getIntExtra("id", -1); //pobieramy z Extra parametr id
    try {
        String httpresponse = executeGET(id);
        showId(httpresponse);
    } catch (Exception e) {
        Toast toast = Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG);
        toast.show();
    }
    // ToDo add your GUI initialization code here        
}

From source file:com.martineve.mendroid.task.MendeleyAPITask.java

@Override
protected void onPostExecute(JSONArray[] result) {
    // invoked on the UI thread

    if (result == null) {
        Log.e("com.martineve.mendroid.task.MendeleyAPITask",
                "Returned NULL; looks like a problem communicating with Mendeley; review stack trace.");

        // there was an error
        CharSequence text = "Error communicating with Mendeley.";
        int duration = Toast.LENGTH_LONG;

        Toast toast = Toast.makeText(c_context, text, duration);
        toast.show();
    }// w w w .  jav a  2s  . c o m
}

From source file:br.com.split.activities.FacebookEscolherLocal.java

private void onError(Exception error) {
    String text = getString(R.string.com_facebook_usersettingsfragment_not_logged_in, error.getMessage());
    Toast toast = Toast.makeText(this, text, Toast.LENGTH_SHORT);
    toast.show();
}

From source file:br.com.split.activities.PickFriendsActivity.java

private void onError(Exception error) {
    //TODO: Arrumar mensagem de excecao
    String text = getString(R.string.com_facebook_requesterror_web_login, error.getMessage());
    Toast toast = Toast.makeText(this, text, Toast.LENGTH_SHORT);
    toast.show();
}

From source file:MainActivity.java

public void showToast(View view) {
    LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View layout = inflater.inflate(R.layout.toast_custom, null);
    ((TextView) layout.findViewById(android.R.id.message)).setText("Custom Toast");
    Toast toast = new Toast(this);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.setDuration(Toast.LENGTH_LONG);
    toast.setView(layout);/*from www  .  jav  a2  s .co m*/
    toast.show();
}

From source file:co.edu.uniajc.vtf.security.controller.ForgotPasswordController.java

public void sendRecoveryMailResult(int pResult) {
    ResourcesManager loResource = new ResourcesManager((Activity) this.coView);
    String lsMessage = "";

    if (pResult == 0) {
        lsMessage = loResource.getStringResource(R.string.forgot_password_message);
    } else {//from   w  ww. java2 s . c om
        lsMessage = loResource.getStringResource(R.string.general_message_error);
    }

    Toast toast = Toast.makeText((Activity) this.coView, lsMessage, Toast.LENGTH_LONG);
    toast.show();
    this.coView.setEmail("");
}