为什么吐司消息中包含移动的Andr​​oid 4.1操作系统不显示吐司、操作系统、消息、Andr

2023-09-07 11:24:43 作者:注定只爱自己

我不能看到的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"); 
}

 
精彩推荐
图片推荐