toast

Equivalent to Android's Toast or Mac OSX Growl in Java Swing?

与世无争的帅哥 提交于 2019-12-21 18:07:29
问题 Looking for a means of displaying transient, non-modal dialogs in a Swing application. In other words, I'd like to pop up a semi-transparent box with some text in it that can be immediately dismissed, or will fade away in a set amount of time. Is there a library to do this? I don't want to reinvent the wheel if it already exists. Growl screenshot: Android Toast screenshot: (source: devx.com) 回答1: This link provides information about "translucent shaped Windows" using Swing, though it does not

Where is this toast coming from?

◇◆丶佛笑我妖孽 提交于 2019-12-21 10:17:02
问题 For some reason the app that I'm working on is displaying a toast that shows the internal storage space left on my device even though I didn't code this in. Here is a screenshot http://i.stack.imgur.com/z2ERU.png And here is the code for the (only) activity. http://pastie.org/8382286 As you can see, all of the toasts are commented out and I'm not even importing android.widget.Toast . Yet I'm still getting the toast shown in the screenshot. Can anyone tell me why this is happening? 回答1: Are

How to display a Toast inside a Handler/thread?

笑着哭i 提交于 2019-12-21 04:46:08
问题 I want to display a toast once the message is sent to a socket.After this "Log.d("ClientActivity", "C: Sent.");" Whether I need to create a separate thread to display Toast? public class ClientActivity extends Activity { private Handler handler = new Handler(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.client); serverIp = (EditText) findViewById(R.id.EditText01); message =(EditText) findViewById(R.id.EditText02);

Error while dispaying an Toast message: Can't create handler inside thread that has not called Looper.prepare()

限于喜欢 提交于 2019-12-21 04:38:11
问题 I am getting an Runtime Exception:Can't create handler inside thread that has not called Looper.prepare() while displaying the Toast message in a worker thread. I have a service (runs in a remote process) which creates an object. This object is responsible for connecting to a server in a thread. I get the response from the sever. I want to display the message from the server in the toast. At that time I getting this exception. I tried posting it in a Handler by using handler.post. But still i

android toast doesn't fit text

孤人 提交于 2019-12-21 04:27:12
问题 I am developing an application where I have to use numerous toasts. I display these toasts by using: Toast.makeText(context, "Some medium-sized text", Toast.LENGTH_SHORT).show(); The displayer toast, however, has the height of one line, while the text is displayed on multiple lines. The result is that I can't view all the text in the toast. How can I fix this? 回答1: Try inserting a carriage-return and line-feed where you want to split the text. These characters refer back to the old typewriter

What is the value of Toast.LENGTH_LONG and Toast.LENGTH_SHORT?

为君一笑 提交于 2019-12-21 03:12:07
问题 I am printing Toast message in my application to show notification but i want to know value of Toast.LENGTH_LONG and Toast.LENGTH_SHORT. What other values i can use. Can anyone tell me what is the value of these two variables? 回答1: There is another question that answers what you are looking for. The answers are: private static final int LONG_DELAY = 3500; // 3.5 seconds private static final int SHORT_DELAY = 2000; // 2 seconds This was courtesy of FeelGood. You can find the whole thread below

android中的Context到底该怎么用

你说的曾经没有我的故事 提交于 2019-12-20 04:22:29
在Android系统中,有很多的service,也就是服务。我们的程序如果用到系统功能,一般都是调用服务间接完成的。也就是在Android系统中存在许多C/S架构。而context的作用,就是android应用连接service的桥梁。比如Activity中有一个方法,getSystemService()。 这个方法调到最后,实际上是调用的ContextImpl的getSystemService()方法。而ContextImpl是对Context的实现 。 Context不是函数而是一个类——如果不太了解面向对象,可以把“类”看做一种数据类型,就像int,不过类型为“类”的数据(称为对象)可能储存远比int多的信息,比如这里的类型为 Context的对象就储存关于程序、窗口的一些资源 。 有些函数调用时需要一个Context参数,比如Toast.makeText, 因为函数需要知道是在哪个界面中显示的Toast 。 再比如,Button myButton = new Button(this); 这里也需要Context参数(this),表示这个按钮是在“this”这个屏幕中显示的 。 Android开发使用(纯粹的)面向对象语言,一切都是对象,就连我们写的函数都是对象的函数。 public class MainActivity extends Activity {

小程序 showLoading与showToast不能共存

丶灬走出姿态 提交于 2019-12-19 15:04:05
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> loading与toast一般不能同时引用,所以一般先把hideloading了,再执行showtoast 之前把hideloading加到了complete中,所以toast就一直出问题 wx.showLoading({ title: '加载中', }) wx.request({ url: '', header: { "thirdSessionKey": app.globalData.thirdSessionKey }, data: { }, success(res) { wx.hideLoading() // loading与toast一般不能同时引用,所以一般先把hideloading了,再执行showtoast wx.showToast({ title: res.data.message, icon: "none", duration: 5000 }) }, fail(){ }, complete(){ // 执行在success和fail之后 } }) 来源: oschina 链接: https://my.oschina.net/u/3950671/blog/3144911

关于部分手机关闭通知权限导致Toast显示不出的问题

纵饮孤独 提交于 2019-12-19 14:40:14
相信很多朋友发现了华为等部分手机把通知权限关闭之后会导致Toast无法正常弹出的情况。 原因:谷歌为了让应用的 Toast 能够显示在其他应用上面,所以使用了通知栏相关的 API,但是这个 API 随着用户屏蔽通知栏而变得不可用,系统错误地认为你没有通知栏权限,从而间接导致 Toast 有 show 请求时被系统所拦截。 解决方法: /** * 检查通知栏权限有没有开启 */ public static boolean isNotificationEnabled ( Context context ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . N ) { NotificationManager manager = ( ( NotificationManager ) context . getSystemService ( Context . NOTIFICATION_SERVICE ) ) ; if ( manager != null ) { return manager . areNotificationsEnabled ( ) ; } else { return false ; } } else if ( Build . VERSION . SDK_INT >= Build . VERSION

第九次作业

烈酒焚心 提交于 2019-12-19 13:00:18
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.itcase.directory.MainActivity"> <LinearLayout android:id="@+id/linearlayout1" android:layout_width="match_parent" android