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.openerp.util.OEBinaryDownloadHelper.java

public void downloadBinary(int id, OEDatabase db, Context context) {
    Log.d(TAG, "OEBinaryDownloadHelper->downloadBinary()");
    mContext = context;/*from   w  ww  . ja  v a2  s. co  m*/
    try {
        if (OpenERPServerConnection.isNetworkAvailable(mContext)) {
            mProgressDialog = new ProgressDialog(mContext);
            mProgressDialog.setMessage("Downloading...");
            mProgressDialog.setIndeterminate(true);
            mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            mProgressDialog.setCancelable(true);

            downloadTask = new DownloadTask(db);
            downloadTask.execute(id);
        } else {
            Toast.makeText(mContext, "Unable to connect server !", Toast.LENGTH_LONG).show();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:eu.thecoder4.gpl.pleftdroid.HandleLinksActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    TextView tv = new TextView(this);

    tv.setText("Verifying Link...");
    setContentView(tv);//  www  .j a  v  a2  s  .c om

    Intent intent = getIntent();
    if (intent.getAction().equals("android.intent.action.VIEW")) {
        try {
            Uri uri = getIntent().getData();
            theurl = uri.toString();

        } catch (Exception e) {
            Toast.makeText(this, R.string.toast_couldnotopenurl, Toast.LENGTH_LONG).show();
        }
    } else if (Intent.ACTION_SEND.equals(intent.getAction())) {

        Bundle extras = intent.getExtras();
        theurl = extras.getCharSequence(Intent.EXTRA_TEXT).toString();
    } else {
        theurl = "";
    }
    //Toast.makeText(this, "The URL  =  "+theurl, Toast.LENGTH_LONG).show();

    // Parse the URL
    // VERIFICATION: verify?id=&u=&p=
    // INVITATION: a?id=&u=&p=
    if (theurl.indexOf("?") < 0 && theurl.indexOf("/verify?") < 0 && theurl.indexOf("/a?") < 0) {
        Toast.makeText(this, R.string.toast_linknotsupp, Toast.LENGTH_LONG).show();
        finish();
    } else {
        Map<String, String> arr = PleftBroker.getParamsFromURL(theurl);

        pserver = arr.get("pserver");
        if (arr.get("id") != null) {
            aid = Integer.parseInt(arr.get("id"));
        } else {
            aid = 0;
        }
        vcode = arr.get("p");
        user = arr.get("u");
        if (aid == 0 || vcode == null || user == null) {
            Toast.makeText(this, R.string.toast_shlinknotvalid, Toast.LENGTH_LONG).show();
            finish();
        } else { // we have a valid Link

            handleLnk = new Runnable() {
                @Override
                public void run() {
                    handleLink();
                }
            };
            Thread thread = new Thread(null, handleLnk, "Handlethrd");
            thread.start();
        } // End - if Link is Valid
    }
}

From source file:com.loopj.android.http.sample.AsyncBackgroundThreadSample.java

@Override
public RequestHandle executeSample(final AsyncHttpClient client, final String URL, final Header[] headers,
        HttpEntity entity, final ResponseHandlerInterface responseHandler) {

    final Activity ctx = this;
    FutureTask<RequestHandle> future = new FutureTask<>(new Callable<RequestHandle>() {
        public RequestHandle call() {
            Log.d(LOG_TAG, "Executing GET request on background thread");
            return client.get(ctx, URL, headers, null, responseHandler);
        }//from  w ww  .ja v a2 s. co  m
    });

    executor.execute(future);

    RequestHandle handle = null;
    try {
        handle = future.get(5, TimeUnit.SECONDS);
        Log.d(LOG_TAG, "Background thread for GET request has finished");
    } catch (Exception e) {
        Toast.makeText(ctx, e.getMessage(), Toast.LENGTH_LONG).show();
        e.printStackTrace();
    }

    return handle;
}

From source file:com.loopj.android.http.sample.RetryRequestSample.java

@Override
protected void onResume() {
    super.onResume();

    if (!wasToastShown) {
        wasToastShown = true;//w w  w .ja va2s .c  o m
        Toast.makeText(this,
                "Exceptions' whitelist and blacklist updated\nSee RetryRequestSample.java for details",
                Toast.LENGTH_LONG).show();
    }
}

From source file:com.martineve.mendroid.activity.ContactsActivity.java

/** Called when the activity is first created. */
@Override//from w ww .j  a  v a2 s.c o  m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.contacts);

    /*if (!OAuth.CONNECTOR.isConnected())
    {
       moveToLogin();
       return;
    }
            
    c_list.clear();*/

    JSONArray contacts;
    try {
        //new MendeleyAPITask(OAuth.CONNECTOR).execute(MendeleyURLs.getURL(MendeleyURLs.CONTACTS), ContactsActivity.this);
        //new MendeleyAPITask(OAuth.CONNECTOR).doFetch(new String[] {MendeleyURLs.getURL(MendeleyURLs.CONTACTS)}, ContactsActivity.this);

        /*contacts = m_conn.getCollections();
        for (int i=0; i< collections.length(); i++) {
            JSONObject collection = collections.getJSONObject(i);
                    
            HashMap<String,String> item = new HashMap<String,String>();
                    
            item.put("line1", collection.getString("name"));
            item.put("line2", collection.getString("size") + " documents");
                    
            m_list.add(item);
        }*/
    } catch (Exception e) {
        Toast.makeText(getApplicationContext(), "\nGot a " + e.getClass().getName() + ": " + e.getMessage(),
                Toast.LENGTH_LONG).show();
        return;
    }

}

From source file:com.github.michalbednarski.intentslab.Utils.java

public static void toastException(Context context, String methodName, Throwable exception) {
    Toast.makeText(context, (methodName != null ? methodName + ": " : "") + describeException(exception),
            Toast.LENGTH_LONG).show();
}

From source file:com.kogitune.wearlocationwatchface.WatchFaceService.java

@Override
public void onPreferenceChange(WearSharedPreference preference, String key, Bundle bundle) {
    Toast.makeText(this, key + ":" + bundle.get(key), Toast.LENGTH_LONG).show();
    if (TextUtils.equals(key, getString(R.string.key_preference_time_text_accent))) {
    }/*from   w w  w .java  2s  .  com*/
}

From source file:es.warp.desktop_droid.TelephonyEventService.java

@Override
public void onCreate() {
    Toast.makeText(this, "My service created", Toast.LENGTH_LONG);
    Log.d("TelephonyEventService", "onCreate");
    TelephonyManager manager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
    manager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
}

From source file:com.applechip.android.showcase.rest.HttpPostFormDataActivity.java

private void showResult(String result) {
    if (result != null) {
        // display a notification to the user with the response information
        Toast.makeText(this, result, Toast.LENGTH_LONG).show();
    } else {/* w ww .  j a  v a2  s.  co m*/
        Toast.makeText(this, "I got null, something happened!", Toast.LENGTH_LONG).show();
    }
}

From source file:com.citrus.sdk.webops.SavecontactDetails.java

@Override
protected void onPostExecute(Void aVoid) {
    super.onPostExecute(aVoid);
    Toast.makeText(activity.getApplicationContext(), result, Toast.LENGTH_LONG).show();
}