Example usage for android.widget Toast LENGTH_LONG

List of usage examples for android.widget Toast LENGTH_LONG

Introduction

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

Prototype

int LENGTH_LONG

To view the source code for android.widget Toast LENGTH_LONG.

Click Source Link

Document

Show the view or text notification for a long period of time.

Usage

From source file:com.ruenzuo.babel.activities.LicensesActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.licenses_activity_layout);
    ButterKnife.inject(this);
    AssetManager assetManager = getAssets();
    try {//from  w  w w.  j  a v  a  2s  .  c  o m
        InputStream inputStream = assetManager.open("licenses/licenses.txt");
        StringWriter stringWriter = new StringWriter();
        IOUtils.copy(inputStream, stringWriter);
        String licenses = stringWriter.toString();
        vwTextLicenses.setText(licenses);
    } catch (IOException e) {
        Toast.makeText(this, getString(R.string.error_while_loading_licenses), Toast.LENGTH_LONG).show();
    }
}

From source file:com.citrus.sdk.interfaces.JSInterface.java

@JavascriptInterface
public void pgResponse(String response) {

    try {/*from   w w w.  jav  a  2 s  .c o  m*/
        JSONObject response_json = new JSONObject(response);
        Toast.makeText(activity.getApplicationContext(), response_json.getString("TxStatus"), Toast.LENGTH_LONG)
                .show();
    } catch (JSONException e) {
        e.printStackTrace();
    }
}

From source file:com.jonbanjo.cupsprint.Util.java

public static void showToast(final Activity activity, final String toast) {
    activity.runOnUiThread(new Runnable() {
        public void run() {
            Toast.makeText(activity, toast, Toast.LENGTH_LONG).show();
        }/*from w w  w .  jav  a 2s .c o  m*/
    });
}

From source file:Main.java

public static void displayFileError(Activity activity) {
    Toast.makeText(activity, "Can't write image to SD card", Toast.LENGTH_LONG).show();
}

From source file:fi.mikuz.boarder.connection.ConnectionUtils.java

public static void connectionSuccessful(Activity activity,
        ConnectionSuccessfulResponse connectionSuccessfulResponse) throws JSONException {
    if (!connectionSuccessfulResponse.getJSONObject().isNull(returnMessage)) {
        Toast.makeText(activity, connectionSuccessfulResponse.getJSONObject().getString(returnMessage),
                Toast.LENGTH_LONG).show();
    }/*from   w ww  .ja  v a 2  s  . c  om*/
}

From source file:MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case MENU_DOWNLOAD:
        Toast.makeText(this, R.string.menu_download, Toast.LENGTH_LONG).show();
        break;//from  w w w . ja va2  s .c  om
    case MENU_SETTINGS:
        Toast.makeText(this, R.string.menu_settings, Toast.LENGTH_LONG).show();
        break;
    default:
        return super.onContextItemSelected(item);
    }
    return true;
}

From source file:com.google.maps.android.utils.demo.BigClusteringDemoActivity.java

@Override
protected void startDemo() {
    getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(51.503186, -0.126446), 10));

    mClusterManager = new ClusterManager<MyItem>(this, getMap());

    getMap().setOnCameraIdleListener(mClusterManager);
    try {//w  w  w  . j  av a 2 s  .co  m
        readItems();
    } catch (JSONException e) {
        Toast.makeText(this, "Problem reading list of markers.", Toast.LENGTH_LONG).show();
    }
}

From source file:com.google.maps.android.utils.demo.ClusteringDemoActivity.java

@Override
protected void startDemo() {
    getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(51.503186, -0.126446), 10));

    mClusterManager = new ClusterManager<MyItem>(this, getMap());
    getMap().setOnCameraIdleListener(mClusterManager);

    try {// www .j ava2 s. c o  m
        readItems();
    } catch (JSONException e) {
        Toast.makeText(this, "Problem reading list of markers.", Toast.LENGTH_LONG).show();
    }
}

From source file:Main.java

public static void CheckDwnloadStatus(DownloadManager downloadManager, Activity activity, long id) {

    // TODO Auto-generated method stub
    DownloadManager.Query query = new DownloadManager.Query();
    query.setFilterById(id);//  w w  w  .j a  va 2s. co  m
    Cursor cursor = downloadManager.query(query);
    if (cursor.moveToFirst()) {
        int columnIndex = cursor.getColumnIndex(DownloadManager.COLUMN_STATUS);
        int status = cursor.getInt(columnIndex);
        int columnReason = cursor.getColumnIndex(DownloadManager.COLUMN_REASON);
        int reason = cursor.getInt(columnReason);

        switch (status) {
        case DownloadManager.STATUS_FAILED:
            String failedReason = "";
            switch (reason) {
            case DownloadManager.ERROR_CANNOT_RESUME:
                failedReason = "ERROR_CANNOT_RESUME";
                break;
            case DownloadManager.ERROR_DEVICE_NOT_FOUND:
                failedReason = "ERROR_DEVICE_NOT_FOUND";
                break;
            case DownloadManager.ERROR_FILE_ALREADY_EXISTS:
                failedReason = "ERROR_FILE_ALREADY_EXISTS";
                break;
            case DownloadManager.ERROR_FILE_ERROR:
                failedReason = "ERROR_FILE_ERROR";
                break;
            case DownloadManager.ERROR_HTTP_DATA_ERROR:
                failedReason = "ERROR_HTTP_DATA_ERROR";
                break;
            case DownloadManager.ERROR_INSUFFICIENT_SPACE:
                failedReason = "ERROR_INSUFFICIENT_SPACE";
                break;
            case DownloadManager.ERROR_TOO_MANY_REDIRECTS:
                failedReason = "ERROR_TOO_MANY_REDIRECTS";
                break;
            case DownloadManager.ERROR_UNHANDLED_HTTP_CODE:
                failedReason = "ERROR_UNHANDLED_HTTP_CODE";
                break;
            case DownloadManager.ERROR_UNKNOWN:
                failedReason = "ERROR_UNKNOWN";
                break;
            default:
                failedReason = "unknown reason";
                break;
            }

            Toast.makeText(activity, "FAILED: " + failedReason, Toast.LENGTH_LONG).show();
            break;
        case DownloadManager.STATUS_PAUSED:
            String pausedReason = "";

            switch (reason) {
            case DownloadManager.PAUSED_QUEUED_FOR_WIFI:
                pausedReason = "PAUSED_QUEUED_FOR_WIFI";
                break;
            case DownloadManager.PAUSED_UNKNOWN:
                pausedReason = "PAUSED_UNKNOWN";
                break;
            case DownloadManager.PAUSED_WAITING_FOR_NETWORK:
                pausedReason = "PAUSED_WAITING_FOR_NETWORK";
                break;
            case DownloadManager.PAUSED_WAITING_TO_RETRY:
                pausedReason = "PAUSED_WAITING_TO_RETRY";
                break;
            }

            Toast.makeText(activity, "PAUSED: " + pausedReason, Toast.LENGTH_LONG).show();
            break;
        case DownloadManager.STATUS_PENDING:
            Toast.makeText(activity, "PENDING", Toast.LENGTH_LONG).show();
            break;
        case DownloadManager.STATUS_RUNNING:
            Toast.makeText(activity, "RUNNING", Toast.LENGTH_LONG).show();
            break;
        case DownloadManager.STATUS_SUCCESSFUL:

            Toast.makeText(activity, "SUCCESSFUL", Toast.LENGTH_LONG).show();
            break;
        }
    }
}

From source file:com.example.schoo.licenseverifer.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    //etSupportActionBar(toolbar);

    //mTextView = (TextView) findViewById(R.id.first_name_label);
    mNfcAdapter = NfcAdapter.getDefaultAdapter(this);

    //   mTextView.setText("NFC is disabled.");

    if (mNfcAdapter == null) {
        // Stop here, we definitely need NFC
        Toast.makeText(this, "This device doesn't support NFC.", Toast.LENGTH_LONG).show();
        finish();/*from  w  w w.  ja  va2  s.c o m*/
        return;

    }

    if (!mNfcAdapter.isEnabled()) {
        //      mTextView.setText("NFC is disabled.");
    } else {
        //    mTextView.setText(R.string.explanation);
        //mTextView.setText("NFC is enabled");
    }

    handleIntent(getIntent());
    initFields();

    signupButton = (Button) findViewById(R.id.signup);
    signupButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            initFields();
        }
    });
}