为什么吐司消息中包含移动的Andr​​oid 4.1操作系统不显示 [英] Why toast message are not show in android 4.1 operating system containing mobile

查看:104
本文介绍了为什么吐司消息中包含移动的Andr​​oid 4.1操作系统不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能看到的Andr​​oid 4.1手机敬酒消息。高达昨天我能看到敬酒消息。从今天起,只有我能不能看到的消息。请帮我。

  Toast.makeText(getApplicationContext(),喜,Toast.LENGTH_SHORT).show();
 

我已经试过,而不是敬酒消息定制敬酒消息还。但仍然没有工作。

自定义敬酒:

  LayoutInflater吹气= getLayoutInflater();
查看布局= inflater.inflate(R.layout.toast_layout,(ViewGroup中)findViewById(R.id.toast_layout_root));
TextView的文字=(TextView的)layout.findViewById(R.id.text);
text.setText(请填写姓名);
吐司面包=新吐司(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL,0,0);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(布局);
toast.show();
 

解决方案

切换到这一点,并再次检查。

 如果(first_name.length()== 0)
{
    Toast.makeText(NameOfYou​​rActivity.this,请填写姓名,Toast.LENGTH_SHORT).show();
    Utilities.writeIntoLog(请填写姓名);
}
 

I cant see the toast message in android 4.1 mobile. Upto yesterday I was able to see the toast message. From today only I can not see the message. Please help me.

Toast.makeText(getApplicationContext(), "hi", Toast.LENGTH_SHORT).show(); 

I have tried custom toast message also instead of toast message. But still not working.

Custom toast:

LayoutInflater inflater=getLayoutInflater(); 
View layout = inflater.inflate(R.layout.toast_layout,(ViewGroup) findViewById(R.id.toast_layout_root)); 
TextView text = (TextView) layout.findViewById(R.id.text); 
text.setText("Please fill Name"); 
Toast toast = new Toast(getApplicationContext()); 
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG); 
toast.setView(layout); 
toast.show();

解决方案

Change to this and check again.

if(first_name.length() == 0) 
{ 
    Toast.makeText(NameOfYourActivity.this, "Please fill Name", Toast.LENGTH_SHORT).show(); 
    Utilities.writeIntoLog("Please fill Name"); 
}

这篇关于为什么吐司消息中包含移动的Andr​​oid 4.1操作系统不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆