toast

How can I send a notification from inside the onProviderDisabled method of a LocationListener

末鹿安然 提交于 2020-01-16 14:08:13
问题 How can I send a notification from inside the onProviderDisabled method of a LocationListener? So far I have been using: Toast.makeText(mainmenu, "GPS Location providers are disabled... blah blah", Toast.LENGTH_LONG).show();}}); but that entails using a static mainmenu variable stored when the mainmenu class is first instantiated - I gather doing it that is a bad idea, in case the mainmenu object gets removed from memory I guess - so I think I should be using notifications. I guess I need to

Android- Making Toast clickable

∥☆過路亽.° 提交于 2020-01-16 04:11:07
问题 I want to make toast click able or a UI element which will have clickable button but behaves like toast. It should not run on UI thread like toast. It should not halt or overlay current user activity, message should come like toast with clickable button and vanish but as toast user should be able to access background ongoing UI item. If any one has any idea about how to achieve this pls share with me. 回答1: The Gmail undo bar is the best suitable for you, its just like a toast with a button.

(安卓)Toast消息队列输出

我怕爱的太早我们不能终老 提交于 2020-01-14 02:07:06
package sc.tool; import java.util.ArrayList; import android.content.Context; import android.os.Handler; import android.os.Looper; import android.widget.Toast; /** 示例:ToastQueue.ShowToastQueue(this, "Toast消息队列逐个输出"); * * ToastQueue.java: Toast消息队列输出,Android 9.0 版本后Toast消息连续输出,后出现的Toast会替换掉之前的Toast消息,使得Toast展示不全(同一时间,仅展示最后一条); * 此类用于实现Toast消息的队列输出,按调用顺序,逐个展示,不覆盖、不丢失。 * * ----- 2020-1-10 下午2:56:44 scimence */ public class ToastQueue { // 示例:ToastQueue.ShowToastQueue(this, ""); // Toast.makeText(activity, info, Toast.LENGTH_SHORT).show(); // ShowToastQueue(activity.getApplicationContext(), info);

Android学习之SQLite的基本使用

雨燕双飞 提交于 2020-01-13 20:10:19
本文主要是针对于初学者使用。 AndroidStudio使用版本: Android Studio 3.5 Build #AI-191.8026.42.35.5791312, built on August 9, 2019 JRE: 1.8.0_202-release-1483-b03 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 7 6.1 Android手机测试版本:Android6.0,华为荣耀6 本博文的实现功能:通过输入Activity,保存输入数据进入SQLite数据库,然后通过宁一个Activity显示出SQLite中的数据信息。 (一)、 在手机上进行数据库的开发,基本步骤主要是以下几步,数据库名: record.db,数据表名:personinfo_record : 1、创建数据库: 创建数据库需要继承SQLiteOpenHelper这个抽象类。 本文中使用的方法是普遍使用方法,可以借鉴。如下: public class DBHelperSub extends SQLiteOpenHelper implements Serializable { private String dbName; private Context context; private SQLiteDatabase

“setView must have been called” - Custom Class extending button

可紊 提交于 2020-01-13 18:24:33
问题 So I've got a 12 x 9 grid of "buttons" called "tiles". Tile.java extends the widget "Button". I've got an issue right now though, where I'm trying to get the button to display a toast that recalls the ID of the button pushed. The grid is added dynamically and I want it to stay that way. Here's the code from GameBoardActivity.java: This makes the 12x9 grid of "tiles" and adds a listener for each. public void gridRowButtons(int iterations){ final Tile[] gridSpaces = new Tile[12]; LinearLayout

第二天 Menu菜单和PopWindow窗口

余生长醉 提交于 2020-01-13 07:48:52
Menu菜单 普通菜单 步骤流程: 在menu菜单当中创建item条目 重写onCreateOptionsMenu方法加载,加载菜单文件。(注:加载方式有静态加载和动态加载) 重写onOptionsItemSelected方法,设置条目监听器,用来实现吐丝效果 上下文菜单 步骤流程: 重写onCreateContextMenu方法,加载上下文菜单 重写onContextItemSelected方法,设置条目监听 setTextColor可以更改组件字体颜色 弹出菜单PopMenu 步骤流程: 在xml布局文件 Java代码 弹出窗口PopWindow 在Activity中的布局 Java 代码 进场动漫 在style文件夹中设置所需加载的全部属性 最后绑定一下动漫 普通菜单 步骤流程: 在res下面创建一个menu文件夹,并新建一个xml文件作为OptionMenu的布局文件 Activity重写onCreateOptionsMenu加载资源文件 Activity重写onOptionsItemSelected加设置事件监听 在menu菜单当中创建item条目 重写onCreateOptionsMenu方法加载,加载菜单文件。(注:加载方式有静态加载和动态加载) // 加载资源文件 @Override public boolean onCreateOptionsMenu ( Menu

Why isn't my service running? (As judged by displaying Toast message.)

泪湿孤枕 提交于 2020-01-13 06:09:35
问题 I am trying to make a service in the background so I can run a loop that requests a page every x minutes. This is my service in the manifest: <service android:name=".webToSMS" android:enabled="true" /> And here is my service being started (in the main activity): Intent intent = new Intent(this, webToSMS.class); startService(intent); And finally, this is my service class: public class webToSMS extends IntentService { public webToSMS() { super("webToSMS"); } @Override protected void

Why isn't my service running? (As judged by displaying Toast message.)

对着背影说爱祢 提交于 2020-01-13 06:09:10
问题 I am trying to make a service in the background so I can run a loop that requests a page every x minutes. This is my service in the manifest: <service android:name=".webToSMS" android:enabled="true" /> And here is my service being started (in the main activity): Intent intent = new Intent(this, webToSMS.class); startService(intent); And finally, this is my service class: public class webToSMS extends IntentService { public webToSMS() { super("webToSMS"); } @Override protected void

Can I send parameters in push notifications to toast (Windows Phone)?

穿精又带淫゛_ 提交于 2020-01-13 02:30:41
问题 I have a case in my app where I need to send a push notification to a user device when the application is offline and appears as a toast notification. I need when the user clicks on the toast message to navigate to a specific page in my application depending on the message. I know that this is available in toast notifications but can I send parameters from my server to the toast to determine the page? 回答1: Of course you can. The XML of the toast notification you send from your server looks

Android 常见工具类封装

时光毁灭记忆、已成空白 提交于 2020-01-12 04:26:12
1,MD5工具类: public class MD5Util { public final static String MD5(String s) { char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; try { byte[] btInput = s.getBytes(); // 获得MD5摘要算法的 MessageDigest 对象 MessageDigest mdInst = MessageDigest.getInstance("MD5"); // 使用指定的字节更新摘要 mdInst.update(btInput); // 获得密文 byte[] md = mdInst.digest(); // 把密文转换成十六进制的字符串形式 int j = md.length; char str[] = new char[j * 2]; int k = 0; for (int i = 0; i < j; i++) { byte byte0 = md[i]; str[k++] = hexDigits[byte0 >>> 4 & 0xf]; str[k++] = hexDigits[byte0 & 0xf]; } return new