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:eltharis.wsn.showAllActivity.java

/**
 * Called when the activity is first created.
 *///from   ww  w .ja  va  2  s.  c  o  m
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    try {
        String response = executeGET();
        showAll(response);
    } catch (Exception e) {
        Toast toast = Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG); //do debuggowania
        toast.show();
    }
    adapter = new ArrayAdapter<User>(this, android.R.layout.simple_list_item_1, users);
    setListAdapter(adapter);
    ListView lv = getListView();
    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { //nasuchiwanie, czy jaki z uytkownikw by nacinity

        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String username = ((TextView) view).getText().toString();
            Toast.makeText(getBaseContext(), username, Toast.LENGTH_SHORT).show();
            User selected = null;
            for (User u : users) {
                if (u.getUsername().equals(username)) {
                    selected = u;
                    break;
                }
            }
            if (selected != null) {
                Intent intent = new Intent(getBaseContext(), showIDActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                intent.putExtra("id", selected.getId()); //dodajemy jako Extra do intentu. S to tak jakby parametry
                getBaseContext().startActivity(intent); //zaczynamy intent
            }
        }
    });
}

From source file:com.facebook.notifications.sample.MainActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    NotificationCardResult result = NotificationsManager.handleActivityResult(requestCode, resultCode, data);

    if (result != null) {
        Toast.makeText(this, "Result: " + result.getActionUri(), Toast.LENGTH_LONG).show();
    }//w ww .  j  a  v a  2s  .c  om
}

From source file:com.filelocker.andy.MainActivity.java

public void browseButton_Click(View view) {
    final TextView vFileChooserText = (TextView) findViewById(R.id.fileChooserText);
    final FileChooserDialog dialog = new FileChooserDialog(this);
    dialog.show();/* w  w  w.jav a  2s.  c  o  m*/
    dialog.addListener(new FileChooserDialog.OnFileSelectedListener() {
        public void onFileSelected(Dialog source, File file) {
            source.hide();
            Toast toast = Toast.makeText(source.getContext(), "File selected: " + file.getName(),
                    Toast.LENGTH_LONG);
            toast.show();
            vFileChooserText.setText(file.getAbsolutePath());
            dialog.hide();
        }

        public void onFileSelected(Dialog source, File folder, String name) {
            source.hide();
            Toast toast = Toast.makeText(source.getContext(), "File created: " + folder.getName() + "/" + name,
                    Toast.LENGTH_LONG);
            toast.show();
            dialog.hide();
        }
    });
}

From source file:com.hybris.mobile.activity.CheckoutActivity.java

@Override
public boolean handleMessage(final Message msg) {
    //      waitView(false);
    switch (msg.what) {
    case CartController.MESSAGE_CART_UPDATED:
        updateUI();/* w  w w . j a  v  a2 s.c  om*/
        showLoadingDialog(false);
        break;

    case CartController.MESSAGE_ORDER_PLACED_ERROR:
        Toast.makeText(getApplicationContext(), ((Exception) msg.obj).getLocalizedMessage(), Toast.LENGTH_LONG)
                .show();
        break;

    case CartController.MESSAGE_ORDER_PLACED_RESPONSE:
        Intent intent = new Intent(CheckoutActivity.this, OrderDetailActivity.class);
        // TODO
        intent.putExtra("orderDetails", JsonUtils.toJson(msg.obj));
        startActivity(intent);

        // Dismiss this activity
        finish();
        return true;
    }
    return false;
}

From source file:io.cloudmatch.demo.pinchandview.PAVServerEventListener.java

@Override
public void onConnectionError(final Exception error) {
    Log.d(TAG, "onConnectionError");
    String msg = "Connection error";
    if (error instanceof CloudMatchInvalidCredentialException) {
        msg = "The API Key and APP Id that you are using seem to be incorrect. Are you running the latest version of CloudMatch Demo?";
    } else if (error instanceof CloudMatchConnectionException) {
        msg = error.getMessage();//from w w w .jav  a 2 s  . c om
    }
    Toast.makeText(mActivity, msg, Toast.LENGTH_LONG).show();
}

From source file:at.bitfire.davdroid.syncadapter.QueryServerDialogFragment.java

@Override
public void onLoadFinished(Loader<ServerInfo> loader, ServerInfo serverInfo) {
    if (serverInfo.getErrorMessage() != null)
        Toast.makeText(getActivity(), serverInfo.getErrorMessage(), Toast.LENGTH_LONG).show();
    else {//from   w ww  . ja  va2  s.c  om
        SelectCollectionsFragment selectCollections = new SelectCollectionsFragment();
        Bundle arguments = new Bundle();
        arguments.putSerializable(SelectCollectionsFragment.KEY_SERVER_INFO, serverInfo);
        selectCollections.setArguments(arguments);

        getFragmentManager().beginTransaction().replace(R.id.fragment_container, selectCollections)
                .addToBackStack(null).commitAllowingStateLoss();
    }

    getDialog().dismiss();
}

From source file:com.nextgis.uikobserver.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mFillDataHandler = new Handler() {
        public void handleMessage(Message msg) {
            Bundle resultData = msg.getData();
            boolean bHaveErr = resultData.getBoolean("error");
            if (bHaveErr) {
                Toast.makeText(MainActivity.this, getResources().getText(R.string.sFailed), Toast.LENGTH_LONG)
                        .show();//from  w  ww. j a  v  a 2 s  . c o  m
            } else {
                Toast.makeText(MainActivity.this, getResources().getText(R.string.sSuccess), Toast.LENGTH_LONG)
                        .show();
            }
        };
    };

    sendButton = (Button) findViewById(R.id.sendDataBtn);
    sendButton.setEnabled(false);
    sendButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            SendData();
        }
    });

    tvLoc = (TextView) findViewById(R.id.locationString);

    tvUIK = (TextView) findViewById(R.id.uikNo);
    tvEMail = (TextView) findViewById(R.id.userMail);
    tvNote = (TextView) findViewById(R.id.notesString);

    locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
    currentLocationListener = new CurrentLocationListener();

    dfLon = 200;
    dfLat = 200;

    sN = (String) getResources().getText(R.string.compas_N);
    sS = (String) getResources().getText(R.string.compas_S);
    sW = (String) getResources().getText(R.string.compas_W);
    sE = (String) getResources().getText(R.string.compas_E);

    sCoordLat = (String) getResources().getText(R.string.coord_lat);
    sCoordLon = (String) getResources().getText(R.string.coord_lon);

    //sUIK, sMail, sNote

    requestLocationUpdates();
}

From source file:com.aniruddhc.acemusic.player.AsyncTasks.AsyncGetSongStreamURLTask.java

@Override
protected void onPostExecute(Boolean result) {
    super.onPostExecute(result);

    try {//w  w w . j av  a2  s.c om
        if (result == true && mApp.getService().getCurrentSong().getId().equals(mSongID)) {
            //We got the right URL, so go ahead and prepare the media player.
            mApp.getService().startPlayback();
        } else if (result == false && mApp.getService().getCurrentSong().getId().equals(mSongID)) {
            //We were unable to get the url, so skip to the next song.
            mApp.getService().skipToNextTrack();
            Toast.makeText(mContext, R.string.song_failed_to_load, Toast.LENGTH_LONG).show();
        } else {
            //The song has been changed, so the URL is now useless. Exit this AsyncTask.
            return;
        }

    } catch (Exception e) {
        return;
    }

}

From source file:com.cse3310.phms.ui.fragments.AppointmentScreenFragment.java

@OptionsItem(R.id.add_icon)
void menuAddAppointment() {
    Toast.makeText(getActivity(), "Select a date to add a new appointment.", Toast.LENGTH_LONG).show();
    isAddMode = true;
}

From source file:com.QuarkLabs.BTCeClient.fragments.ActiveOrdersFragment.java

@Override
public void onLoadFinished(Loader<JSONObject> loader, JSONObject data) {
    if (data == null) {
        Toast.makeText(getActivity(), getResources().getString(R.string.GeneralErrorText), Toast.LENGTH_LONG)
                .show();// w  ww  . j a  v  a 2 s.c  o  m
        mNoItems.setText(getResources().getString(R.string.OoopsError).toUpperCase(Locale.US));
        mListView.setEmptyView(mNoItems);
        mLoadingView.setVisibility(View.GONE);
    } else if (data.optInt("success") == 0) {
        mNoItems.setText(data.optString("error").toUpperCase(Locale.US));
        mListView.setEmptyView(mNoItems);
        mLoadingView.setVisibility(View.GONE);
    } else {
        mAdapter.updateEntries(data);
        mListView.setAdapter(mAdapter);
        mLoadingView.setVisibility(View.GONE);
        mListView.setEmptyView(mNoItems);
    }
}