• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Toast类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.holoeverywhere.widget.Toast的典型用法代码示例。如果您正苦于以下问题:Java Toast类的具体用法?Java Toast怎么用?Java Toast使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Toast类属于org.holoeverywhere.widget包,在下文中一共展示了Toast类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCheckedChanged

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
public void onCheckedChanged(CompoundButton buttonView,
		boolean isChecked) {
	if (isChecked) {
		if (settingsData.getContactList().length < 1) {
			toggle.setChecked(false);
			Toast.makeText(FallMonitorActivity.this,
					"Enter at least one emergency contact",
					Toast.LENGTH_LONG).show();
		} else if (isMyServiceRunning() == false)
			startAccelService();
		else
			setEnabled(true);

	} else
		stopAccelService();
	// stopService(new Intent(FallMonitorActivity.this,
	// AccelerometerService.class));
}
 
开发者ID:ericcurtin,项目名称:Fall-Monitor,代码行数:19,代码来源:FallMonitorActivity.java


示例2: onSuccess

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
/**
 * A callback used when the user has successfully selected a user to send to
 */
protected void onSuccess() {
	SharedPreferences.Editor editor = (Editor) this.getActivity().getSharedPreferences(RESEND_INFO_KEY, Context.MODE_PRIVATE).edit();
	String text = getCaption();
	if (text == null)
		text = "";
	
	String resendFile = new File(this.getActivity().getCacheDir(), RESEND_FILE_PATH + (isPhoto() ? ".jpg" : ".mp4")).getAbsolutePath();
	if (FileIO.bufferedCopy(filePath, resendFile) < 0) {
		StatMethods.hotBread(this.getActivity(), "Error saving file for resend", Toast.LENGTH_SHORT);
	}
	
	editor.putString(SnapEditorBaseFrag.CAPTION_KEY, text).putString(SnapEditorBaseFrag.FILE_PATH_KEY, resendFile)
			.putBoolean(SnapEditorBaseFrag.MEDIA_TYPE_KEY, isPhoto()).putInt(SnapEditorBaseFrag.SNAP_TIME_KEY, snapTime).commit();
	
	onFragmentPopped();
	this.getActivity().setResult(Activity.RESULT_OK);
	this.getActivity().finish();
}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:22,代码来源:BaseContactSelectFrag.java


示例3: onPostExecute

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
@Override
protected void onPostExecute(Camera camera) {
	if (camera != null && mCameraContainer != null) {
              try {
                  mPreviewWidget = new Preview(BaseCaptureFrag.this.getActivity(), camera);
              } catch (RuntimeException e) {
                  return;
              }
              mPreviewWidget.setKeepScreenOn(true);
              mCameraContainer.addView(mPreviewWidget);
              FrameLayout.LayoutParams previewParams = (android.widget.FrameLayout.LayoutParams) mPreviewWidget.getLayoutParams();
              previewParams.gravity = Gravity.CENTER;
              mPreviewWidget.setLayoutParams(previewParams);
              camLoaded = true;
	} else {
		StatMethods.hotBread(getActivity(), "Error getting camera", Toast.LENGTH_LONG);

              if (mOnFailureRestart != -1) {
                  new LazyCameraLoader(-1).execute(mOnFailureRestart);
              }
	}
	
}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:24,代码来源:BaseCaptureFrag.java


示例4: onOptionsItemSelected

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	// Respond to the action bar's Up/Home button
	case android.R.id.home:
		NavUtils.navigateUpFromSameTask(this);
		return true;
	case R.id.map_bureau_proche:
		
		if(map.getMyLocation()==null){
			Toast.makeText(this,"Impossible de récuperer votre position",
					Toast.LENGTH_LONG).show();
		}else{
		new LongOperation().execute();}
		
		return true;
	}
	return super.onOptionsItemSelected(item);
}
 
开发者ID:WassimBenltaief,项目名称:laposte-android,代码行数:20,代码来源:MapActivity.java


示例5: onCreate

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);

	Global.init(this);

	FragmentManager fragmentManager = getSupportFragmentManager();
	Fragment fragment = fragmentManager.findFragmentById(R.id.mainFragment);
	if (fragment == null)
	{
		FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
		fragmentTransaction.replace(R.id.mainFragment, new MedicationOverviewFragment());
		fragmentTransaction.commit();
	}

	Medication.loadAll(this, new Medication.OnMedicationLoadedListener()
	{
		@Override public void onMedicationLoaded(List<Medication> loadedMedication)
		{
			Toast.makeText(MainActivity.this, "Loaded " + loadedMedication.size() + " medication(s)", Toast.LENGTH_SHORT).show();
		}
	});
}
 
开发者ID:Abolitionist-Project,项目名称:MediModo-Android,代码行数:25,代码来源:MainActivity.java


示例6: onEventMainThread

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
public void onEventMainThread(ValidateAlertResult event) {
    switch (event.getValidationResult()) {
        case NO_DAYS:
        case NO_LINES:
        case NO_TIME:
        case NO_TITLE:
            Toast.makeText(getActivity(), event.getValidationResult().getMessageResId(),
                    Toast.LENGTH_SHORT).show();
            break;
        case SUCCESS:
            AddOrUpdateAlertRequest request = new AddOrUpdateAlertRequest(event.getAlert());
            getEventBus().post(request);
            finishActivity();
            break;
    }
}
 
开发者ID:antonyt,项目名称:TflTravelAlerts,代码行数:17,代码来源:EditAlertFragment.java


示例7: onCreate

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	
	this.requestWindowFeature(Window.FEATURE_NO_TITLE);
	this.setContentView(R.layout.snap_dialog);
	
	WindowManager.LayoutParams params = this.getWindow().getAttributes();
	params.gravity = Gravity.CENTER;
	this.getWindow().setAttributes(params);
	
	ListView listView = (ListView)this.findViewById(R.id.listView1);
	listView.setAdapter(new DialogListAdapter());
	
	int snapno = this.getIntent().getIntExtra(SNAP_NO, -1);
	if (snapno == -1) {
		StatMethods.hotBread(this, "Error: missing mSnap number in intent", Toast.LENGTH_SHORT);
		this.finish();
	}
	
	mSnap = LocalSnaps.getInstanceUnsafe().getSnapAt(snapno);
	
	mSnapTime = mSnap.getDisplayTime();
	mIsPhoto = mSnap.isPhoto();
	if (!mIsPhoto) {
		mCaption = mSnap.getCaption();
		mCaptionOri = mSnap.getCaptionOrientation();
		mCaptionPos = mSnap.getCaptionLocation();
	}
	
	mAllowSaves = SettingsAccessor.getAllowSaves(this);
	try {
		mFilePath = mSnap.getSnapPath(this);
	} catch (IOException e) {
		Twig.debug("SnapDialogActivity", "Error getting path");
	}
}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:38,代码来源:SnapDialogActivity.java


示例8: tempSnapClick

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
private void tempSnapClick(TempSnap snap, int position) {
    if (snap.isSending()) {
        // ignore for the moment
    } else if (snap.isSent()) {
        // also ignore
    } else { // attempt to send snap
        String filePath = snap.getFilePath();
        Message toPost;
        if (!new File(filePath).exists()) {
            StatMethods.hotBread(this.getActivity(), "Error! File missing!", Toast.LENGTH_SHORT);
            snap.setError(true);
            toPost = mHandler.obtainMessage(GuiHandler.REFRESH_VIEW, GuiHandler.TEMPSNAP, position, snap.getId());
        } else {
            if (StatMethods.isNetworkAvailable(this.getActivity(), true)) {
                snap.setIsSending(true).setError(false).setUploadPercent(-1);
                new SnapUpload(this.getSupportApplication(), snap).execute(
                        null, GlobalVars.getUsername(this.getActivity()),
                        GlobalVars.getAuthToken(this.getActivity())
                );
                toPost = mHandler.obtainMessage(GuiHandler.REPEAT_REFRESH_VIEW, GuiHandler.TEMPSNAP, position, snap.getId());
            } else {
                toPost = null;
            }
        }

        if (toPost != null) {
            mHandler.sendMessage(toPost);
        }
    }
}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:31,代码来源:SnapViewerListFrag.java


示例9: onIabPurchaseFinished

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
@Override
public void onIabPurchaseFinished(IabResult result, Purchase info) {
    if (result.isFailure()) {
        Twig.debug(FRAG_TAG, "Error purchasing: " + result);
        StatMethods.hotBread(TutorialContactFrag.this.getActivity(), "Press the options button to purchase at any time", Toast.LENGTH_LONG);
    } else if (info.getSku().equals(SKU.PREMIUM_FEATURES)) {
        SettingsAccessor.setPremium(TutorialContactFrag.this.getActivity(), true);
        StatMethods.hotBread(TutorialContactFrag.this.getActivity(), "Purchase successful. Premium features enabled! Thank-you!", Toast.LENGTH_LONG);
    }
}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:11,代码来源:TutorialContactFrag.java


示例10: onIabPurchaseFinished

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
@Override
public void onIabPurchaseFinished(IabResult result, Purchase info) {
    if (result.isFailure()) {
        Twig.debug(FRAG_TAG, "Error purchasing: " + result);
        StatMethods.hotBread(TutorialSnapFrag.this.getActivity(), "Press the options button to purchase at any time", Toast.LENGTH_LONG);
    } else if (info.getSku().equals(SKU.PREMIUM_FEATURES)) {
        SettingsAccessor.setPremium(TutorialSnapFrag.this.getActivity(), true);
        StatMethods.hotBread(TutorialSnapFrag.this.getActivity(), "Purchase successful. Premium features enabled! Thank-you!", Toast.LENGTH_LONG);
    }
}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:11,代码来源:TutorialSnapFrag.java


示例11: onLoginClick

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
/**
 * Called when clicking on the login button in the login screen.
 * @param v The button that was pressed.
 */
public void onLoginClick(View v)
{
	EditText vEdit = (EditText)this.findViewById(R.id.loginEdit);
	EditText vPword = (EditText)this.findViewById(R.id.pwordEdit);
	if (vEdit == null || vPword == null)
		return;
	
	String login = vEdit.getText().toString().trim().toLowerCase();
	String pWord = vPword.getText().toString().trim();
	if (StatMethods.IsStringNullOrEmpty(login)) {
		StatMethods.hotBread(this, "Login field is empty", Toast.LENGTH_SHORT);
		return;
	}
	else if (StatMethods.IsStringNullOrEmpty(pWord)) {
		StatMethods.hotBread(this, "Password field is empty", Toast.LENGTH_SHORT);
		return;
	}
	
	if (!StatMethods.isNetworkAvailable(this, true))
		return;
	
	Button loginButton = (Button)this.findViewById(R.id.button1);
	loginButton.setVisibility(View.INVISIBLE);
	ProgressBar pb1 = (ProgressBar)this.findViewById(R.id.progressBar1);
	pb1.setVisibility(View.VISIBLE);
	//new BGLogin(this.getApplicationContext(), null).execute("login", login, pWord);
       new LoginTask(this.getApplicationContext(), login, pWord).execute();
}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:33,代码来源:LaunchActivity.java


示例12: onIabPurchaseFinished

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
@Override
public void onIabPurchaseFinished(IabResult result, Purchase info) {
    if (result.isFailure()) {
        Twig.debug(TAG, "Error purchasing: " + result);
    } else if (info.getSku().equals(SKU.PREMIUM_FEATURES)) {
        SettingsAccessor.setPremium(LaunchActivity.this, true);
        StatMethods.hotBread(LaunchActivity.this, "Purchase successful. Premium features enabled! Thank-you!", Toast.LENGTH_LONG);
    }
    LaunchActivity.this.startActivityForResult(new Intent(LaunchActivity.this, Settings.class), Settings.REQUEST_RESULT_CODE);

}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:12,代码来源:LaunchActivity.java


示例13: onPreferenceChange

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    if (newValue instanceof String) {
        try {
            //noinspection ResultOfMethodCallIgnored
            Integer.valueOf((String) newValue);
            return true;
        } catch (NumberFormatException e) {
            // ignore and pass control to final return
        }
    }
    StatMethods.hotBread(Settings.this, "Please enter a valid integer number", Toast.LENGTH_SHORT);
    return false;
}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:15,代码来源:Settings.java


示例14: onClick

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
@Override
public void onClick(DialogInterface dialog, int which) {
	if (DeleteSnap.deleteSnapAndRescanMedia(MediaPreview.this, getImgPath())) {
		StatMethods.hotBread(MediaPreview.this, "Delete successful", Toast.LENGTH_SHORT);
		MediaPreview.this.finish();
	} else {
		StatMethods.hotBread(MediaPreview.this, "Error during delete!", Toast.LENGTH_SHORT);
	}
}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:10,代码来源:MediaPreview.java


示例15: onPostExecute

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
@Override
protected void onPostExecute(Integer result) {
	if (result < 0) {
		mSnap.setError(true);
		TempSnaps.getInstanceUnsafe().write(mLocalContext);
		if (mDoNotifications) {
			Notifications.updateUploadNotificationWithError();
		}
	} 
	switch (result) {
		case -1:
			StatMethods.hotBread(mLocalContext, "Error during param parsing", Toast.LENGTH_LONG);
			return;
		case -2:
			StatMethods.hotBread(mLocalContext, "Error during file upload", Toast.LENGTH_LONG);
			return;
		case -3:
			StatMethods.hotBread(mLocalContext, "Error during file send", Toast.LENGTH_LONG);
			return;
		case -4:
			StatMethods.hotBread(mLocalContext, "Note: file copy did not succeed", Toast.LENGTH_LONG);
			return;
	}
	if (mDoNotifications) {
		Notifications.updateUploadNotificationWithFinish();
	}
	mSnap.setSent(true).setIsSending(false).setTimeStamp(System.currentTimeMillis());
	TempSnaps.getInstanceUnsafe().write(mLocalContext);
}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:30,代码来源:SnapUpload.java


示例16: onPostExecute

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
@Override
protected void onPostExecute(Bitmap bitmap) {
	if (bitmap == null) {
		StatMethods.hotBread(getActivity(), "Error loading pic", Toast.LENGTH_SHORT);
	} else if (imgView != null) {
		imgView.setImageBitmap(bitmap);
	}
	if (workers != null) {
		workers.remove(this);
	}
}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:12,代码来源:SnapEditorPicFrag.java


示例17: sendMultipleDelay

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
private void sendMultipleDelay() {
	String users = "";
	for (int i = 0; i < selectedUsers.size() - 1; i++) {
		users += selectedUsers.get(i) + ",";
	}
	users += selectedUsers.get(selectedUsers.size() - 1);
	TempSnap newSnap = TempSnaps.getInstanceUnsafe().add();
	
	newSnap.setUsers(users);
	
	File finalPath = new File(Environment.getExternalStorageDirectory() + CameraUtil.ROOT_PATH + CameraUtil.PICTURE_PATH,
			newSnap.getId() + selectedUsers.get(0).toUpperCase(Locale.ENGLISH) + ".jpg");
	
	if (FileIO.bufferedCopy(filePath, finalPath.getAbsolutePath()) < 0) {
		StatMethods.hotBread(getActivity(), "File copy failed! Try again later", Toast.LENGTH_SHORT);
		TempSnaps.getInstanceUnsafe().remove(getActivity(), newSnap);
		return;
	}
	
	newSnap.setFilePath(finalPath.getAbsolutePath());
	if (isPhoto()) {
		newSnap.setMediaType(MediaType.PHOTO).setCaptionTime(snapTime);
	} else {
		newSnap.setMediaType(MediaType.VIDEO).setVideoCaption(getCaption()).setCaptionPosition(getCaptionLocation()).setCaptionOrientation(getCaptionOrientation());
	}
	
	TempSnaps.getInstanceUnsafe().write(getActivity());
	
	StatMethods.hotBread(this.getActivity(), "Saved for later...", Toast.LENGTH_SHORT);
	onSuccess();
	
	//this.getActivity().setResult(Activity.RESULT_OK);
	//this.getActivity().finish();
}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:35,代码来源:BaseContactSelectFrag.java


示例18: onLongClick

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
@Override
public boolean onLongClick(View v) {
    if (hasText()) {
        // Don't show the cheat sheet for items that already show text.
        return false;
    }

    final int[] screenPos = new int[2];
    final Rect displayFrame = new Rect();
    getLocationOnScreen(screenPos);
    getWindowVisibleDisplayFrame(displayFrame);

    final Context context = getContext();
    final int width = getWidth();
    final int height = getHeight();
    final int midy = screenPos[1] + height / 2;
    final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;

    Toast cheatSheet = Toast.makeText(context, mItemData.getTitle(), Toast.LENGTH_SHORT);
    if (midy < displayFrame.height()) {
        // Show along the top; follow action buttons
        cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT,
                screenWidth - screenPos[0] - width / 2, height);
    } else {
        // Show along the bottom center
        cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, height);
    }
    cheatSheet.show();
    return true;
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:31,代码来源:ActionMenuItemView.java


示例19: updateLineStatus

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
@Override
protected void updateLineStatus() {
    if (mRefreshIcon != null) {
        Animation anim = (Animation) mRefreshIcon.getTag();
        mRefreshIcon.startAnimation(anim);
    }

    Toast.makeText(getActivity(), "updating all lines", Toast.LENGTH_SHORT).show();
    getEventBus().postSticky(new LineStatusUpdateRequest());
}
 
开发者ID:antonyt,项目名称:TflTravelAlerts,代码行数:11,代码来源:LineStatusViewerListFragment.java


示例20: onEventMainThread

import org.holoeverywhere.widget.Toast; //导入依赖的package包/类
public void onEventMainThread(LineStatusUpdateSuccess event) {
    if (mRefreshIcon != null) {
        mRefreshIcon.clearAnimation();
    }

    LineStatusUpdateSet lineStatusUpdateSet = event.getData();
    mAdapter.updateLineStatus(lineStatusUpdateSet.getLineStatusUpdates());
    updateTimestamp(lineStatusUpdateSet.getDate());

    if (lineStatusUpdateSet.isOldResult()) {
        Toast.makeText(getActivity(), "Old result - updating...", Toast.LENGTH_SHORT).show();
        updateLineStatus();
    }
}
 
开发者ID:antonyt,项目名称:TflTravelAlerts,代码行数:15,代码来源:LineStatusViewerListFragment.java



注:本文中的org.holoeverywhere.widget.Toast类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TraversalEngine类代码示例发布时间:2022-05-23
下一篇:
Java RajawaliRenderer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap