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.temboo.example.YouTubeResultView.java

/**
 * A utility method to retrieve the thumbnail image on a separate thread, and populate
 * the image view with that thumbnail/*from   w  w  w  .  ja va2  s  .c o  m*/
 * @param urlString - the URL of the thumbnail to retrieve
 * @param imageView - the view to populate with the thumbnail
 */
private void fetchDrawableOnThread(final String urlString, final ImageView imageView) {

    final Handler handler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            imageView.setImageDrawable((Drawable) message.obj);
        }
    };

    Thread thread = new Thread() {
        @Override
        public void run() {
            try {
                DefaultHttpClient httpClient = new DefaultHttpClient();
                HttpGet request = new HttpGet(urlString);
                HttpResponse response = httpClient.execute(request);
                InputStream is = response.getEntity().getContent();
                Drawable drawable = Drawable.createFromStream(is, "src");

                Message message = handler.obtainMessage(1, drawable);
                handler.sendMessage(message);
            } catch (Exception e) {
                Toast.makeText(getContext(), "An error occurred retrieving the video thumbnail",
                        Toast.LENGTH_LONG).show();
            }
        }
    };
    thread.start();
}

From source file:com.eurotong.orderhelperandroid.Common.java

@SuppressLint("ShowToast")
public static Toast GetToastLong(String msg) {

    Toast tst = Toast.makeText(MyApplication.getAppContext(), msg, Toast.LENGTH_LONG);
    return tst;// w ww  .  j  a  v a 2s  .  c o  m
}

From source file:com.ryan.ryanreader.common.General.java

public static void quickToast(final Context context, final String text) {
    new Handler(Looper.getMainLooper()).post(new Runnable() {
        public void run() {
            Toast.makeText(context, text, Toast.LENGTH_LONG).show();
        }//w w  w  . j  a  v a 2  s .c  om
    });
}

From source file:br.com.cams7.siscom.member.MemberEdit.java

private boolean validate() {
    StringBuffer warnMsg = new StringBuffer();
    if (etName.getText().toString().trim().equals(STRING_EMPTY))
        warnMsg.append(getString(R.string.member_name) + ": ").append(getString(R.string.msg_name_empty));

    if (etPhone.getText().toString().trim().equals(STRING_EMPTY))
        warnMsg.append(getStringNewLine(warnMsg) + getString(R.string.member_phoneNumber) + ": ")
                .append(getString(R.string.msg_phone_empty));
    if (etEmail.getText().toString().trim().equals(STRING_EMPTY))
        warnMsg.append(getStringNewLine(warnMsg) + getString(R.string.member_email) + ": ")
                .append(getString(R.string.msg_email_empty));

    boolean validate = warnMsg.length() == 0;
    if (!validate)
        Toast.makeText(getBaseContext(), warnMsg.toString(), Toast.LENGTH_LONG).show();

    return validate;
}

From source file:br.ufc.mdcc.benchimage2.util.ExportData.java

@Override
protected void onPostExecute(Void result) {
    super.onPostExecute(result);
    // fecha o dialog e avisa que terminou...
    progressDialog.dismiss();/*from w ww.ja v a 2s.  com*/
    Toast.makeText(context, "Exportao completada!", Toast.LENGTH_LONG).show();
}

From source file:com.piggate.samples.PiggateLogin.Activity_Main.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    _piggate = new Piggate(this, null); //Initialize a Piggate object
    Boolean logout = false; //Handle if the user is logged
    if (getIntent().getExtras() != null)
        logout = getIntent().getExtras().getBoolean("ACTIVITY_MAIN_CREATED_BY_BUTTON_LOGOUT", false);
    setContentView(R.layout.activity_main);

    final Button login = (Button) findViewById(R.id.buttonloginmain);
    final Button register = (Button) findViewById(R.id.buttonregistermain);

    //onClick listener of the login button: go to Activity_SingIn
    login.setOnClickListener(new View.OnClickListener() {
        @Override/*  w ww .  ja  v a  2 s . com*/
        synchronized public void onClick(View v) {
            if (!handledClick) {
                handledClick = true;

                Intent slideactivity = new Intent(Activity_Main.this, Activity_SingIn.class);
                Bundle bndlanimation = ActivityOptions
                        .makeCustomAnimation(getApplicationContext(), R.anim.flip1, R.anim.flip2).toBundle();
                startActivity(slideactivity, bndlanimation);
            }

        }
    });

    //onClick listener of the register button: go to Activity_SingUp
    register.setOnClickListener(new View.OnClickListener() {
        @Override
        synchronized public void onClick(View v) {
            if (!handledClick) {
                handledClick = true;

                Intent slideactivity = new Intent(Activity_Main.this, Activity_SingUp.class);
                Bundle bndlanimation = ActivityOptions
                        .makeCustomAnimation(getApplicationContext(), R.anim.flip1, R.anim.flip2).toBundle();
                startActivity(slideactivity, bndlanimation);

            }

        }
    });

    //If you close the application without logout, the session will be active
    //Call a listener of the RequestUser method for Piggate object
    if (!logout && checkInternetConnection()) //If you close the application without logout, the session will be active
        _piggate.RequestUser().setListenerRequest(new Piggate.PiggateCallBack() {

            //Method onComplete for JSONObject
            //If the request is completed correctly the user is redirected to Activity_Logged
            @Override
            public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) {
                Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
                Intent slideactivity = new Intent(Activity_Main.this, Activity_Logged.class);
                Bundle bndlanimation = ActivityOptions
                        .makeCustomAnimation(getApplicationContext(), R.anim.flip1, R.anim.flip2).toBundle();
                startActivity(slideactivity, bndlanimation);
            }

            //Method onError for JSONObject
            //When we have an error, reload the Piggate object
            @Override
            public void onError(int statusCode, Header[] headers, String msg, JSONObject data) {
                _piggate.reload();
            }

            //Method onComplete for JSONArray
            @Override
            public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) {
                //Unused
            }

            //Method onError for JSONArray
            @Override
            public void onError(int statusCode, Header[] headers, String msg, JSONArray data) {
                //Unused
            }
        }).exec();
}

From source file:com.scooter1556.sms.androidtv.fragment.MediaElementGridFragment.java

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

    // Set root media element
    mediaElement = (MediaElement) getActivity().getIntent().getSerializableExtra("Directory");

    if (mediaElement == null) {
        Toast.makeText(getActivity(), getString(R.string.error_loading_media), Toast.LENGTH_LONG).show();
        getActivity().finishAfterTransition();
    }/* www .j a  v  a2 s.com*/

    if (savedInstanceState == null) {
        setTitle(mediaElement.getTitle());
        prepareEntranceTransition();
    }

    // Initialise interface
    prepareBackgroundManager();
    VerticalGridPresenter gridPresenter = new VerticalGridPresenter();
    gridPresenter.setNumberOfColumns(NUM_COLUMNS);
    setGridPresenter(gridPresenter);

    setOnSearchClickedListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            // ToDo: Implement search feature
            Toast.makeText(getActivity(), getString(R.string.error_search_not_implemented), Toast.LENGTH_SHORT)
                    .show();
        }
    });

    setOnItemViewClickedListener(new ItemViewClickedListener());
    setOnItemViewSelectedListener(new ItemViewSelectedListener());

    // Set search icon color.
    setSearchAffordanceColor(ContextCompat.getColor(getActivity(), R.color.search_opaque));

    getMediaElements();
}

From source file:com.piggate.samples.PiggateLoginApplication.Activity_Main.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    _piggate = new Piggate(this, null); //Initialize a Piggate object
    Boolean logout = false;//w ww  .  j a  va 2 s  .c o m
    if (getIntent().getExtras() != null)
        logout = getIntent().getExtras().getBoolean("ACTIVITY_MAIN_CREATED_BY_BUTTON_LOGOUT", false); //handles if the user is logged
    setContentView(R.layout.activity_main);
    final Button login = (Button) findViewById(R.id.buttonloginmain);
    final Button register = (Button) findViewById(R.id.buttonregistermain);

    //onClick listener of the login button: go to Activity_SingIn
    login.setOnClickListener(new View.OnClickListener() {
        @Override
        synchronized public void onClick(View v) {
            if (!handledClick) {
                handledClick = true;

                Intent slideactivity = new Intent(Activity_Main.this, Activity_SingIn.class);
                Bundle bndlanimation = ActivityOptions
                        .makeCustomAnimation(getApplicationContext(), R.anim.flip1, R.anim.flip2).toBundle();
                startActivity(slideactivity, bndlanimation);
            }

        }
    });

    //onClick listener of the register button: go to Activity_SingUp
    register.setOnClickListener(new View.OnClickListener() {
        @Override
        synchronized public void onClick(View v) {
            if (!handledClick) {
                handledClick = true;

                Intent slideactivity = new Intent(Activity_Main.this, Activity_SingUp.class);
                Bundle bndlanimation = ActivityOptions
                        .makeCustomAnimation(getApplicationContext(), R.anim.flip1, R.anim.flip2).toBundle();
                startActivity(slideactivity, bndlanimation);

            }

        }
    });

    //If you close the application without logout, the session will be active
    //Call a listener of the RequestUser method for Piggate object
    if (!logout && checkInternetConnection()) //If you close the application without logout, the session will be active
        _piggate.RequestUser().setListenerRequest(new Piggate.PiggateCallBack() {

            //Method onComplete for JSONObject
            //If the request is completed correctly the user is redirected to Activity_Logged
            @Override
            public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) {
                Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
                Intent slideactivity = new Intent(Activity_Main.this, Activity_Logged.class);
                Bundle bndlanimation = ActivityOptions
                        .makeCustomAnimation(getApplicationContext(), R.anim.flip1, R.anim.flip2).toBundle();
                startActivity(slideactivity, bndlanimation);
            }

            //Method onError for JSONObject
            //When we have an error, reload the Piggate object
            @Override
            public void onError(int statusCode, Header[] headers, String msg, JSONObject data) {
                _piggate.reload();
            }

            //Method onComplete for JSONArray
            @Override
            public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) {
                //Unused
            }

            //Method onError for JSONArray
            @Override
            public void onError(int statusCode, Header[] headers, String msg, JSONArray data) {
                //Unused
            }
        }).exec();
}

From source file:com.arantius.tivocommander.ExploreCommon.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle bundle = getIntent().getExtras();
    if (MindRpc.init(this, bundle))
        return;// w  w w .jav a  2  s  .  c  o  m

    if (bundle != null) {
        mCollectionId = bundle.getString("collectionId");
        mContentId = bundle.getString("contentId");
        mOfferId = bundle.getString("offerId");
        mRecordingId = bundle.getString("recordingId");
    }

    if (getParent() == null) {
        Utils.logError("Null getParent() in ExploreCommon.onCreate() ?!");
        Utils.toast(this, R.string.unexpected_please_report, Toast.LENGTH_LONG);
        finish();
        return;
    }

    getParent().setProgressBarIndeterminateVisibility(true);
    MindRpcRequest req = getRequest();
    MindRpc.addRequest(req, mListener);
}

From source file:com.lsb.inomet.Inomet.java

protected void datuak_irakurri() { //Funtzio honekin Asynctask-a marchan jartzen dugu datuak irakurtzeko

    final captureData task = new captureData();
    try {/*  www .  ja va2 s  .co m*/
        if (primera_vez)
            task.execute(new URI("http://10.123.5.43 "), null, null);
        else {
            task.execute(new URI("http://" + direccionWeb), null, null);
        }
    } catch (URISyntaxException e) {
        Toast.makeText(this, "Direccin " + direccionWeb + " incorrecta.", Toast.LENGTH_LONG).show();
        Log.d(TAG, e.getMessage());
    }
}