toast

Android: Display a toast message after a custom time when a button is clicked

拜拜、爱过 提交于 2019-12-12 09:46:49
问题 I want to add a toast say after 30 seconds when a button is clicked. Can you please help me out. 回答1: Something like that: Button button = new Button(this); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { Toast.makeText(context, "Hello!", Toast.LENGTH_LONG).show(); } }, 30000); } }); 回答2: You can use a Handler with postDelayed() . You can find the

WP8 App opens by tapping on Toast

感情迁移 提交于 2019-12-12 01:44:38
问题 I'm developing an application for windows phone 8. I need to check if my app is opened by tapping on a toast notification. How can I do that? Suppose I cannot get any information from the toast. 回答1: If you check out the MSDN article here http://msdn.microsoft.com/en-us/library/windows/apps/jj662938(v=vs.105).aspx, you'll see that it is possible to add extra information to the toast that you can use in your app! Deep linking to a screen using toast notifications You can use the Param element

Showing an ArrayList content on a Toast

荒凉一梦 提交于 2019-12-12 01:34:18
问题 I have a listView and I want to print the arrrayList which contains the selected items. I can show the choice that I choose every time. i.e. if I select a choice, I can print it in a toast (I mark it in my code as a comment), but I want to print the whole choices together. Any help please? Thanks.. 回答1: If I understand correctly, you want to display the contents of your arrayList in a Toast. Like donfuxx said, you need to create your arrayList outside of your onclicklistener. As the user

Using Toast in a external class

我怕爱的太早我们不能终老 提交于 2019-12-11 19:49:46
问题 I have a class that controls my app logic apart from the one who extends Activity, and its declared inside this last one. I would like to know if there is a way to use toast on that class. I tried extending that class with Activity and sending the context in his constructor but it didn't work. EDIT: Here you have the code of how I pass the context in the constructor: GameController newgame = new GameController(getApplicationContext()); public GameController(Context _context) { //... context =

Countdown timer on toast doesn't work anymore after android update

点点圈 提交于 2019-12-11 17:42:19
问题 I updated android to newer version and suddenly the countdown timer hat was set on my toasts is not working anymore, the toast disappear after little time despite what time I put in my countodown timer. What could have happened? ClickableSpan clickablespan1 = new ClickableSpan() { @Override public void onClick(View widget) { if (toast != null) { toast.cancel(); toast = null; } toast = Toast.makeText(Poeshitesto.this, "touch to continue", Toast.LENGTH_SHORT); toast.show(); new CountDownTimer

How to use iziToast in ionic2 project?

柔情痞子 提交于 2019-12-11 15:34:28
问题 I have a ionic2 project and now I want to add iziToast into it. I tried importing it like follows: import { izitoast } from 'izitoast'; But it gives me izitoast as undefined. However, I tried searching for the angular2 support for this library and I found ng2-iziToast It's not working just installing and importing it to the app.module 回答1: You are trying to import a named export izitoast like you are used to in Ionic/Angular ( import { x } from 'y' ) but izitoast is not built on the ES2015

In android custom_toast_layout, layout margin is not working

大兔子大兔子 提交于 2019-12-11 14:49:19
问题 I am using the custom toast and in it i am providing layout_margin right but it is not working any suggestion where is the problem.below is the code i am using. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/custom_toast_layout_id" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFF" android:orientation="horizontal" android:layout_marginRight="200dip"> <ImageView

Toast Immediately

ⅰ亾dé卋堺 提交于 2019-12-11 12:32:40
问题 I would like to have a Toast Message appear while my app is downloading information but even if I put it before my code it doesn't appear until after the download has completed. Putting my code in a separate thread causes many headaches but putting toast in a separate thread doesn't work either. Is there anyway I can have this Toast message come up before this or am I just going to have to work through the headaches? 回答1: You should be putting asynchronous downloads in a separate thread

Kill android toast?

限于喜欢 提交于 2019-12-11 11:28:40
问题 I have a button and on button click toast appears, if the user clicks on button several times and go to previous activity or even close the aplication toast is still visible, How to finish or cancel the toast when user goes to any other activity or how to prevent generation of toast? Toast.makeText(getApplicationContext(), "Enter correct goal!", Toast.LENGTH_SHORT).show() 回答1: try this cancel() Toast by using handler Toast toast = Toast.makeText(getApplicationContext(), "Test", Toast.LENGTH