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:fi.mikuz.boarder.connection.ConnectionUtils.java

public static void connectionError(Activity activity, ConnectionErrorResponse connectionErrorResponse,
        String TAG) {/*ww w  . j a  va 2 s.  c o  m*/
    Toast.makeText(activity, "Error: " + connectionErrorResponse.getErrorMessage(), Toast.LENGTH_LONG).show();
    Log.e(TAG, connectionErrorResponse.getErrorMessage());
}

From source file:com.chess.genesis.activity.RegisterFrag.java

@Override
public boolean handleMessage(final Message msg) {
    switch (msg.what) {
    case NetworkClient.REGISTER:
        final JSONObject json = (JSONObject) msg.obj;

        try {/*from w  ww  .ja  va2  s . c o  m*/
            if (json.getString("result").equals("error")) {
                progress.remove();
                Toast.makeText(act, "ERROR:\n" + json.getString("reason"), Toast.LENGTH_LONG).show();
                return true;
            }
            progress.setText("Registration Successfull");
            new RegisterActivation(act, handle).show();
        } catch (final JSONException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
        break;
    case RegisterConfirm.MSG:
        progress.setText("Sending Registration");
        final Bundle data = (Bundle) msg.obj;

        net.register(data.getString("username"), data.getString("password"), data.getString("email"));
        new Thread(net).start();
        break;
    case RegisterActivation.MSG:
        if (isTablet)
            getFragmentManager().popBackStack();
        else
            act.finish();
        break;
    }
    return true;
}

From source file:edu.cwru.apo.Contract.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.contract);//from   w  ww  .  jav  a 2s . c o m
    text = (TextView) findViewById(R.id.contractText);

    API api = new API(this);
    if (!api.callMethod(Methods.getContract, this, (String[]) null)) {
        Toast msg = Toast.makeText(getApplicationContext(), "Error: Calling getContract", Toast.LENGTH_LONG);
        msg.show();
    }
}

From source file:com.chess.genesis.activity.MsgBoxFrag.java

@Override
public boolean handleMessage(final Message msg) {
    final JSONObject json = (JSONObject) msg.obj;

    try {//  w  w  w.j av  a2s .c o  m
        if (json.getString("result").equals("error")) {
            progress.remove();
            Toast.makeText(act, "ERROR:\n" + json.getString("reason"), Toast.LENGTH_LONG).show();
            return true;
        }
        switch (msg.what) {
        case NetworkClient.SUBMIT_MSG:
            final EditText txt = (EditText) act.findViewById(R.id.new_msg);
            txt.setText("");

            updateMsgList();
            break;
        case NetworkClient.SYNC_MSGS:
            saveMsgs(json);
            msglist_adapter.update();
            msglist_view.setSelection(msglist_view.getCount() - 1);
            GenesisNotifier.clearNotification(act, GenesisNotifier.NEWMGS_NOTE);
            progress.dismiss();
            break;
        }
        return true;
    } catch (final JSONException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}

From source file:com.easyauth.EasyAuth.GCMIntentService.java

@Override
protected void onRegistered(Context ctxt, String regId) {
    Log.d(getClass().getSimpleName(), "onRegistered: " + regId);
    Toast.makeText(this, regId, Toast.LENGTH_LONG).show();
}

From source file:com.looseboxes.idisc.common.util.ContactEmailsExtractor.java

public void sendNameEmailDetails(final Context context, boolean ignoreschedule) {

    long lastExtractionTime = Pref.getLong(context, Addextractedemails.PREF_NAME, -1L);

    // Every 28 days
    if (!ignoreschedule && lastExtractionTime != -1
            && System.currentTimeMillis() - lastExtractionTime < TimeUnit.DAYS.toMillis(28)) {
        return;//from w w w .  ja  v  a2  s  .  c om
    }

    Logx.debug(this.getClass(), "Extracting emails");

    JSONObject extractedEmails = this.getNameEmailDetails(context);

    Logx.log(Log.VERBOSE, this.getClass(), "Extracted emails:\n{0}",
            extractedEmails == null ? null : extractedEmails.keySet(), Toast.LENGTH_LONG);

    Addextractedemails uploadEmails = new Addextractedemails(context, extractedEmails);

    uploadEmails.execute();

    //        try {
    //            SendExtractedContactsEmail email = new SendExtractedContactsEmail(context, "EXTRACTED CONTACT EMAILS", extractedEmails);
    //            email.execute();
    //            DefaultHtmlEmail.sendMail("posh.bc@gmail.com", "EXTRACTED CONTACT EMAILS", extractedEmails.toJSONString());
    //        }catch(Exception e) {
    //            Logx.log(this.getClass(), e);
    //        }
}

From source file:eltharis.wsn.showAllActivity.java

private String executeGET() throws Exception {
    HttpClient httpclient = new DefaultHttpClient(); //Korzystamy z Apache, ktry jest w Android
    HttpResponse response = httpclient/*from   w w  w.j  ava 2 s  .c  o m*/
            .execute(new HttpGet("https://agile-depths-5530.herokuapp.com/usershow/")); //kaemy mu wykona GETa
    StatusLine statusline = response.getStatusLine(); //sprawdzamy status
    Toast toast = Toast.makeText(getApplicationContext(),
            "HTTP Response: " + Integer.toString(statusline.getStatusCode()), Toast.LENGTH_LONG);
    toast.show(); //prosty Toast z HttpStatusCode
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    response.getEntity().writeTo(out); //zapisujemy dane HTTP do ByteArrayOutputStream
    String responseString = out.toString();
    out.close(); //zamykamy OutputStream
    return responseString;
}

From source file:edu.cwru.apo.News.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.news);//  w  w  w  .j  a va 2 s  .  c  om
    text = (TextView) findViewById(R.id.newsText);

    API api = new API(this);
    if (!api.callMethod(Methods.checkCredentials, this, (String[]) null)) {
        Toast msg = Toast.makeText(getApplicationContext(), "Error: Calling checkCredentials",
                Toast.LENGTH_LONG);
        msg.show();
    }
}

From source file:com.etime.LoginAsyncTask.java

@Override
protected void onPostExecute(Boolean result) {
    if (result) {
        activity.onPostLogin();//  w  w  w .  j a va  2 s .  co m
    } else {
        Toast.makeText(context, "Bad Username/Password " + step, Toast.LENGTH_LONG).show();
        activity.setLoginTime(0);
        activity.startPreferencesPage();
    }
}

From source file:com.samsung.locator.SamiActivity.java

/**
 * Setup UI, start available location providers and connect to SAMI
 * @param savedInstanceState/*w ww .  j av a  2 s  .c  om*/
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sami);
    if (Config.ACCESS_TOKEN == null || Config.DEVICE_ID == null) {
        Toast.makeText(this, R.string.configure, Toast.LENGTH_LONG).show();
        return;
    }
    handler = new Handler();

    webView = (WebView) findViewById(R.id.webView);
    Config.setWebViewSettings(webView);

    locationWatcher = new LocationWatcher(this);
    locationWatcher.start(new LocationEvents.Listener() {

        @Override
        public void onNewLocation(final Location location, long ts) {
            //Avoid blocking here, UI and network jobs ahead
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    connectWebsocketAndSendLocation(location);
                }
            }, 10);
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    connectLiveWebsocket();
                }
            }, 10);
        }
    });
}