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.martineve.mendroid.task.MendeleyAPITask.java

@Override
protected void onPostExecute(JSONArray[] result) {
    // invoked on the UI thread

    if (result == null) {
        Log.e("com.martineve.mendroid.task.MendeleyAPITask",
                "Returned NULL; looks like a problem communicating with Mendeley; review stack trace.");

        // there was an error
        CharSequence text = "Error communicating with Mendeley.";
        int duration = Toast.LENGTH_LONG;

        Toast toast = Toast.makeText(c_context, text, duration);
        toast.show();/*w w w  .  ja v a2  s .  c  o m*/
    }
}

From source file:com.elkriefy.android.apps.authenticationexample.credentialsgrace.CredGraceActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.credentials_grace_activity_main);
    mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
    Button purchaseButton = (Button) findViewById(R.id.purchase_button);
    if (!mKeyguardManager.isKeyguardSecure()) {
        // Show a message that the user hasn't set up a lock screen.
        Toast.makeText(this,
                "Secure lock screen hasn't set up.\n"
                        + "Go to 'Settings -> Security -> Screenlock' to set up a lock screen",
                Toast.LENGTH_LONG).show();
        purchaseButton.setEnabled(false);
        return;/* w  w  w.  j  a v a 2  s  .  c  o m*/
    }
    createKey();
    findViewById(R.id.purchase_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // Test to encrypt something. It might fail if the timeout expired (30s).
            tryEncrypt();
        }
    });
}

From source file:com.hybris.mobile.fragment.RegistrationFragment.java

@Override
public void onSubmit(ArrayList<String> array) {

    if (!(array.get(4).equals(array.get(5)))) {
        Toast.makeText(applicationContext, R.string.error_password_mismatch, Toast.LENGTH_LONG).show();
        return;/*from   w ww  . j a v  a2s  . c o m*/
    }

    String titleCode = "";

    for (GenericNameCode obj : mTitles) {
        if (StringUtils.equals(obj.getName(), array.get(0).toString())) {
            titleCode = obj.getCode();
            break;
        }
    }

    QueryCustomer query = new QueryCustomer();
    query.setFirstName(array.get(1).toString());
    query.setLastName(array.get(2).toString());
    query.setTitleCode(titleCode);
    query.setLogin(array.get(3).toString());
    query.setPassword(array.get(4).toString());

    RESTLoader.execute(getActivity(), WebserviceMethodEnums.METHOD_REGISTER_CUSTOMER, query, this, true, true);
}

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

public AsyncPinSongsTask(Context context) {

    //Context.//from w ww.j av a  2  s . c  o  m
    mContext = context;
    songIdsList = new ArrayList<String>();
    songTitlesList = new ArrayList<String>();

    //If the cache storage directory for local copies doesn't exist, go ahead and create it.
    File cacheFolder = null;
    try {
        cacheFolder = new File(mContext.getCacheDir().getCanonicalPath() + "/music");
        if (!cacheFolder.exists()) {
            cacheFolder.mkdirs();
        }
    } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
        Toast.makeText(mContext, R.string.download_failed_to_initialize, Toast.LENGTH_LONG).show();
        return;
    }

    mApp = (Common) mContext.getApplicationContext();
    try {
        mSaveLocation = cacheFolder.getCanonicalPath();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:edu.asu.msse.sgowdru.moviesqldb.SearchMovie.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search_movie);
    info = new TextView[5];
    //In the info array of TextView type store id of each field
    info[0] = (TextView) findViewById(R.id.autoCompleteTextView);
    info[1] = (TextView) findViewById(R.id.editTitleSearch);
    info[2] = (TextView) findViewById(R.id.editGenreSearch);
    info[3] = (TextView) findViewById(R.id.editYearSearch);
    info[4] = (TextView) findViewById(R.id.editActorsSearch);

    //Ratings field is of type Spinner class with field values (PG, PG-13, R rated)
    dropdown = (Spinner) findViewById(R.id.spinnerSearch);
    adapter = ArrayAdapter.createFromResource(this, R.array.Ratings, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    dropdown.setAdapter(adapter);/* ww  w.j  a v a 2 s. c  om*/

    btn = (Button) findViewById(R.id.addSearch);

    context = getApplicationContext();
    duration = Toast.LENGTH_LONG;

    db = new MoviesDB(this);
    try {
        crsDB = db.openDB();
    } catch (SQLException e) {
        e.printStackTrace();
    }

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line,
            gen);
    AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.editGenreSearch);
    textView.setAdapter(adapter);
}

From source file:com.mani.volleydemo.SSLConnectionActivity.java

private void showToast(String msg) {
    Toast.makeText(SSLConnectionActivity.this, msg, Toast.LENGTH_LONG).show();
}

From source file:com.example.ehrtemplateviewerexample.TemplateViewerActivity.java

private void submitTemplate() {
    boolean error = false;
    for (ArchetypeFragment af : this.archetypeFragments) {
        try {/*  ww  w .  j av a 2 s .  c o m*/
            af.getFormContainer().submitAllWidgets();
        } catch (InvalidDatatypeException e) {
            Log.e(TAG, "Error submitting forms:" + e.getMessage());
            e.printStackTrace();
            Toast.makeText(this, "Error Validating Template:" + e.getMessage(), Toast.LENGTH_LONG).show();
            error = true;
        }
    }

    if (!error)
        Toast.makeText(this, "Template content successfully saved.", Toast.LENGTH_LONG).show();
    else
        Toast.makeText(this, "Template content was not successfully saved.", Toast.LENGTH_LONG).show();
}

From source file:com.github.chenxiaolong.dualbootpatcher.appsharing.AppSharingService.java

private void onPackageRemoved(final String pkg) {
    RomInformation info;/*  www  .  j ava2 s . c o m*/

    MbtoolConnection conn = null;

    try {
        conn = new MbtoolConnection(this);
        MbtoolInterface iface = conn.getInterface();

        info = RomUtils.getCurrentRom(this, iface);
    } catch (Exception e) {
        Log.e(TAG, "Failed to determine current ROM. App sharing status was NOT updated", e);
        return;
    } finally {
        IOUtils.closeQuietly(conn);
    }

    if (info == null) {
        Log.e(TAG, "Failed to determine current ROM. App sharing status was NOT updated");
        return;
    }

    // Unshare package if explicitly removed. This only exists to keep the config file clean.
    // Mbtool will not touch any app that's not listed in the package database.
    RomConfig config = RomConfig.getConfig(info.getConfigPath());
    HashMap<String, SharedItems> sharedPkgs = config.getIndivAppSharingPackages();
    if (sharedPkgs.containsKey(pkg)) {
        sharedPkgs.remove(pkg);
        config.setIndivAppSharingPackages(sharedPkgs);
        config.apply();

        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                String message = getString(R.string.indiv_app_sharing_app_no_longer_shared);
                Toast.makeText(AppSharingService.this, String.format(message, pkg), Toast.LENGTH_LONG).show();
            }
        });
    }
}

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

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

    pd.dismiss();/* w  w  w  .  j  a v  a  2 s  .c o  m*/
    if (result == true) {
        if (mSourceType == FilesFoldersFragment.FOLDER)
            Toast.makeText(mContext, R.string.folder_deleted, Toast.LENGTH_SHORT).show();
        else
            Toast.makeText(mContext, R.string.file_deleted, Toast.LENGTH_SHORT).show();

    } else {
        if (mSourceType == FilesFoldersFragment.FOLDER)
            Toast.makeText(mContext, R.string.folder_could_not_be_deleted, Toast.LENGTH_LONG).show();
        else
            Toast.makeText(mContext, R.string.file_could_not_be_deleted, Toast.LENGTH_LONG).show();

    }

    try {
        mFragment.refreshListView();
    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:com.wikitude.example.ARBrowserActivity.java

/** Called when the activity is first created. */
@Override//from w  w w. j  ava  2 s . c om
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // let the application be fullscreen
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    // check if the device fulfills the SDK'S minimum requirements
    if (!ArchitectView.isDeviceSupported(this)) {
        Toast.makeText(this, "minimum requirements not fulfilled", Toast.LENGTH_LONG).show();
        this.finish();
        return;
    }
    setContentView(R.layout.main);

    // set the devices' volume control to music to be able to change the
    // volume of possible soundfiles to play
    this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
    this.architectView = (ArchitectView) this.findViewById(R.id.architectView);
    // onCreate method for setting the license key for the SDK
    architectView.onCreate(apiKey);

    // in order to inform the ARchitect framework about the user's location
    // Androids LocationManager is used in this case
    // NOT USED IN THIS EXAMPLE
    // locManager =
    // (LocationManager)getSystemService(Context.LOCATION_SERVICE);
    // locManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0,
    // 0, this);

    // Getting LocationManager object from System Service LOCATION_SERVICE
    LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);

    // Creating a criteria object to retrieve provider
    Criteria criteria = new Criteria();

    // Getting the name of the best provider
    String provider = locationManager.getBestProvider(criteria, true);

    // Getting Current Location
    Location location = locationManager.getLastKnownLocation(provider);

    locationManager.requestLocationUpdates(provider, 20000, 0, this);

    // Getting latitude of the current location
    fLat = location.getLatitude();

    // Getting longitude of the current location
    fLng = location.getLongitude();

}