Java Code Examples for android.widget.Toast.LENGTH_LONG

The following are Jave code examples for showing how to use LENGTH_LONG of the android.widget.Toast class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.

+ Save this method
Example 1
Project: my-ministry-assistant-master View Source Vote up 6 votes
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
	File intDB = getApplicationContext().getDatabasePath(MinistryDatabase.DATABASE_NAME);
	File extDB = FileUtils.getExternalDBFile(getApplicationContext(), "auto-daily.db");
	
	try {
		if(extDB != null) {
			if(!extDB.exists())
				extDB.createNewFile();
			
			FileUtils.copyFile(intDB, extDB);
		}
	} catch (IOException e) {
		Toast.makeText(getApplicationContext(), "Error during daily backup", Toast.LENGTH_LONG).show();
	}
	
	return Service.START_NOT_STICKY;
}
 
Example 2
Project: Grinnell-DB-Android-master View Source Vote up 6 votes
public void sendDetailedQuery() {

		String theURL = "https://itwebapps.grinnell.edu/classic/asp/campusdirectory/GCdefault.asp?transmit=true&blackboardref=true&LastName="
				+ mActivity.cleanString(lastNameText.getText().toString())
				+ "&LNameSearch=startswith&FirstName="
				+ mActivity.cleanString(firstNameText.getText().toString())
				+ "&FNameSearch=startswith&email="
				+ mActivity.cleanString(usernameText.getText().toString())
				+ "&campusphonenumber="
				+ mActivity.cleanString(phoneText.getText().toString())
				+ "&campusquery="
				+ mActivity.cleanString(campusAddressText.getText().toString())
				+ "&Homequery="
				+ mActivity.cleanString(homeAddressText.getText().toString())
				+ "&Department="
				+ mActivity.cleanString(facDeptSpinner.getSelectedItem()
						.toString())
				+ "&Major="
				+ mActivity.cleanString(studentMajorSpinner.getSelectedItem()
						.toString())
				+ "&conc="
				+ mActivity.cleanString(concentrationSpinner.getSelectedItem()
						.toString())
				+ "&SGA="
				+ mActivity
						.cleanString(sgaSpinner.getSelectedItem().toString())
				+ "&Hiatus="
				+ mActivity.cleanHiatus(hiatusSpinner.getSelectedItem()
						.toString())
				+ "&Gyear="
				+ mActivity.cleanString(studentClassSpinner.getSelectedItem()
						.toString()) + "&submit_search=Search";

		if (mActivity.inGrinnell)
			new RequestTask(mActivity).execute(theURL);
		else {
			Toast toast = Toast
					.makeText(mActivity,
							"Connect to Grinnell College Student Network for Detailed Search",
							Toast.LENGTH_LONG);
			toast.show();
		}
	}
 
Example 3
Project: dlna-master View Source Vote up 6 votes
public void handleMessage(android.os.Message msg) {
 	     switch (msg.what) {
case 1:
	Toast.makeText(YouApplication.GetGlobalContext(), R.string.olc_sd_no_fullspace, Toast.LENGTH_LONG).show();
	break;
case 2:
	Toast.makeText(YouApplication.GetGlobalContext(), R.string.download_no_sd, Toast.LENGTH_LONG).show();
	break;
default:
	break;
}
 	}
 
Example 4
Project: androhid-master View Source Vote up 6 votes
@Override
  public void onListItemClick(ListView  l, View v, int position, long id) {
  	// Assign new host to pair with
  	AndroHid.remoteHidDeviceAddress = btDevices.get(position).btAddress;
  	// Save this host in Preferences
  	AndroHid.myPreferences
  		.edit()
  		.putString( "REMOTE_HID_DEVICE_ADDRESS", AndroHid.remoteHidDeviceAddress )
  		.commit();
Toast.makeText(this.getApplicationContext(), "Selected Bluetooth Device: " +
		btDevices.get( position ).humanReadableName,
		Toast.LENGTH_LONG).show();
  }
 
Example 5
Project: AndroidLibraryProject-master View Source Vote up 6 votes
/**
 * Method to enable Light Sensor in Android
 * */
public void enableLightSensor(SensorEventListener listenerFromActivity, int sampleRate)
{

	if(listenerFromActivity!=null)
	{
		listener = listenerFromActivity;
	}
	else			
	{	
		if(CAFConfig.isEnableDebugging())
		{
			Log.d(TAG,"enableLightSensor Method");
			Log.d(TAG,"listenerFromActivity is null");
		}

	}
	mSensorManager = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE);
	if(mSensorManager == null)
	{
		if(enableDebugging)
		{
			Log.d(TAG,"Light Sensor not found");
			Toast.makeText(this,"No Light Sensor found! quit-",Toast.LENGTH_SHORT).show();
		}
	}
	else
	{
		if(enableDebugging)
		{
			Log.d(TAG,"Light Sensor Found");
			Toast.makeText(mContext,"Light Sensor found",Toast.LENGTH_LONG).show();
		}
		try{
			mLight = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
			mSensorManager.registerListener(listener, mLight , sampleRate);
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
}
 
Example 6
Project: BioWiki-master View Source Vote up 6 votes
void editMedia() {
    hideKeyboard();

    final String mediaId = this.getMediaId();
    final String title = mTitleView.getText().toString();
    final String description = mDescriptionView.getText().toString();
    final Blog currentBlog = BioWiki.getCurrentBlog();
    final String caption = mCaptionView.getText().toString();

    ApiHelper.EditMediaItemTask task = new ApiHelper.EditMediaItemTask(mediaId, title,
            description, caption,
            new ApiHelper.GenericCallback() {
                @Override
                public void onSuccess() {
                    String blogId = String.valueOf(currentBlog.getLocalTableBlogId());
                    BioWiki.wpDB.updateMediaFile(blogId, mediaId, title, description,
                            caption);
                    if (getActivity() != null) {
                        Toast.makeText(getActivity(), R.string.media_edit_success, Toast.LENGTH_LONG).show();
                    }
                    setMediaUpdating(false);
                    if (hasCallback()) {
                        mCallback.onSavedEdit(mediaId, true);
                    }
                }

                @Override
                public void onFailure(ApiHelper.ErrorType errorType, String errorMessage, Throwable throwable) {
                    if (getActivity() != null) {
                        Toast.makeText(getActivity(), R.string.media_edit_failure,
                                Toast.LENGTH_LONG).show();
                    }
                    setMediaUpdating(false);
                    getSherlockActivity().invalidateOptionsMenu();
                    if (hasCallback()) {
                        mCallback.onSavedEdit(mediaId, false);
                    }
                }
            }
    );

    List<Object> apiArgs = new ArrayList<Object>();
    apiArgs.add(currentBlog);

    if (!isMediaUpdating()) {
        setMediaUpdating(true);
        task.execute(apiArgs);
    }

}
 
Example 7
Project: android_Findex-master View Source Vote up 6 votes
public void sendLongMessage(String message) {
    if (mToast != null) {
        mToast.cancel();
    }

    mToast = Toast.makeText(mContext, message, Toast.LENGTH_LONG);
    mToast.show();
}
 
Example 8
Project: Gui2Go-master View Source Vote up 5 votes
@Override
public boolean onDrag(View v, DragEvent event)
{
	final int action = event.getAction();
	EditorActivity act = (EditorActivity) getActivity();

	switch (action) {
		case DragEvent.ACTION_DRAG_STARTED:
			// what happens when the event starts
			if (event.getClipDescription().hasMimeType(
					ClipDescription.MIMETYPE_TEXT_PLAIN)) {
				act.showDeleteBtn();
				return (true);
			} else {
				return (false);
			}
		case DragEvent.ACTION_DRAG_ENTERED:
			hightlightTargetView(v, "#66FF00",
					R.drawable.hightlight_border_green, false);
			tempHighlightedId = v.getId();
			return (true);
		case DragEvent.ACTION_DRAG_LOCATION:
			return (false);
		case DragEvent.ACTION_DRAG_EXITED:
			tempHighlightedId = 0;
			removeHighlight(v);
			return (true);
		case DragEvent.ACTION_DROP:
		{
			View viewHolder = null;
			ViewGroup viewParent = null;
			ClipData.Item item = event.getClipData().getItemAt(0);
			final String dragData = (String) item.getText();

			if (!dragData.equals(((View) v.getParent()).getTag()
					.toString())) {
				viewHolder = activity.findViewById(Integer
						.valueOf(dragData));
				int parentId = Integer.valueOf(((ViewGroup) v
						.getParent()).getTag().toString());
				viewParent = (ViewGroup) activity
						.findViewById(parentId);

				if (viewHolder.getId() != ((View) viewParent
						.getParent()).getId()) {
					// delete the widget from its current parent
					if (EditorActivity.mode != null) {
						EditorActivity.mode.finish();
						act.ClearHightlightedViews(false);
					}
					act.DeleteWidget(viewHolder);
					// add it to new parent
					act.InsertViewToParent(viewHolder, viewParent);
				}
				return (true);
			}

		}
		case DragEvent.ACTION_DRAG_ENDED:
			tempHighlightedId = 0;
			removeHighlight(v);
			return (true);
		default:
			Toast.makeText(activity, "Unknown drag received",
					Toast.LENGTH_LONG).show();
			return (false);
	}
}