toast

Android第八次作业

↘锁芯ラ 提交于 2019-12-02 11:57:25
界面: 功能: QQ登录界面,默认设置登录账号为admin,密码也为admin。 (1)、如果输入账号或密码其中任意一个错误直接显示密码错误请重试,此时会清空账号密码输入框中的内容,勾选与未勾选记住密码按钮,效果一样; (2)、如果账号密码都输入正确没勾选记住密码按钮,则显示登陆成功,未保存; (3)、如果账号密码都输入正确,且勾选了记住密码按钮,则显示登陆成功已保存,此时保存了密码,之后再重新进入app账号密码自动显示在屏幕的相应位置,保存数据均用 SharedPreferences 数据存储方式 。 (4)、保存数据的文件及内容 Layout代码: <?xml version="1.0" encoding="utf-8"?> <LinearLayout 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:orientation="vertical" tools:context=".MainActivity"> <ImageView android:layout

Toast not generating text from selected item from list

只谈情不闲聊 提交于 2019-12-02 11:08:30
问题 I've made a simple app in android with list View,In that i want to make a toast when select an item,i have tried as below but its not working.. my code is as below: main.java package com.example.listview; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import android.os.Bundle; import android.app.Activity; import android.app.ListActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import

Android toast message from a separate thread class

六月ゝ 毕业季﹏ 提交于 2019-12-02 08:30:27
I am confused about how to use Toast to print out messages. I need to use it to print out messages that come from the thread's while loop. My thread which renders graphics are on a different class than my activity. I mean, they are not implemented in the same file. Is there a way to do this? You can use runOnUiThread : myActivity.runOnUiThread(new Runnable() { public void run() { Toast.makeText(context, text, duration).show(); } }); 来源: https://stackoverflow.com/questions/15057631/android-toast-message-from-a-separate-thread-class

扩展用户体验-Dialog,Toast,Notification

╄→尐↘猪︶ㄣ 提交于 2019-12-02 08:14:03
创建一个Dialog对话框 实例化一个Dialog实例,设置标题和布局,分别使用setTitle和setContentView。 例子: // Create the new Dialog. Dialog dialog = new Dialog(MyActivity.this); // Set the title. dialog.setTitle(“Dialog Title”); // Inflate the layout. dialog.setContentView(R.layout.dialog_view); // Update the Dialog’s contents. TextView text = (TextView)dialog.findViewById(R.id.dialog_text_view); text.setText(“This is the text in my dialog”); // Display the Dialog. dialog.show(); 使用AlertDialog类 去构建一个AlertDialog的UI,需要创建一个新的AlertDialog.Builder对象: AlertDialog.Builder ad = new AlertDialog.Builder(context); 你可以用此来设置标题、消息,还可以设置按钮,选择条目

Android 登陆页面发送短信

喜夏-厌秋 提交于 2019-12-02 06:23:40
//最重要的一步一定要有这一步 1、打开项目根目录的build.gradle,在buildscrip–>dependencies 模块下面添加 classpath ‘com.mob.sdk:MobSDK:+’,如下所示: buildscript { repositories { … } dependencies { … //只需要加我注释下面这个 classpath “com.mob.sdk:MobSDK:+” } } 在使用SMSSDK模块的build.gradle中,添加MobSDK插件和扩展,如下所示: // 添加插件 apply plugin: ‘com.mob.sdk’ // 在MobSDK的扩展中注册SMSSDK的相关信息 MobSDK { appKey “申请Mob的appkey” appSecret “申请Mob的AppSecret” SMSSDK {} } //接下来我们想要做的是一个注册页面,点击发送短信得到一个短信验证 //废话不多说直接上代码 无论是textview还是button都可以 layout布局 <TextView android:id="@+id/regist_duanxin" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text

Toast Notification not working

别等时光非礼了梦想. 提交于 2019-12-02 04:09:23
问题 Below method executes on call for set Toast, but doesnot display any Toast after time elasped. Is any more setting required for Windows 8 Metro app Toast notification int scheduledToastCounter = 1; public void Set_Future_Toast() { XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02); XmlNodeList stringElements = toastXml.GetElementsByTagName("text"); stringElements.Item(0).AppendChild(toastXml.CreateTextNode("Scheduled Toast")); DateTimeOffset

Toast not generating text from selected item from list

故事扮演 提交于 2019-12-02 03:38:23
I've made a simple app in android with list View,In that i want to make a toast when select an item,i have tried as below but its not working.. my code is as below: main.java package com.example.listview; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import android.os.Bundle; import android.app.Activity; import android.app.ListActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget

Why does my text keep highlighting?

北城以北 提交于 2019-12-02 03:35:19
I am making a "toast" in vb.net, and whenever it pops up, all the text in the body textbox is ALWAYS highlighted...how can I remove the highlight programmatically? Thanks! Here is the code which seems to be automatically highlighting: Dim i As Integer toast.HeaderL.Text = headertext toast.BodyL.Text = contenttext toast.Show() toast.Opacity = 0 i = 0 While i < 100 toast.SetDesktopLocation(My.Computer.Screen.WorkingArea.Right - toast.Width, My.Computer.Screen.WorkingArea.Bottom - ((toast.Height / 100) * i)) toast.Opacity += 0.01 wait(7) i += 1 End While wait(4000) toast.Opacity = 1 i = 0 While i

Toast Notification not working

旧巷老猫 提交于 2019-12-02 02:51:49
Below method executes on call for set Toast, but doesnot display any Toast after time elasped. Is any more setting required for Windows 8 Metro app Toast notification int scheduledToastCounter = 1; public void Set_Future_Toast() { XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02); XmlNodeList stringElements = toastXml.GetElementsByTagName("text"); stringElements.Item(0).AppendChild(toastXml.CreateTextNode("Scheduled Toast")); DateTimeOffset displayTime = DateTimeOffset.UtcNow.AddSeconds(3); ScheduledToastNotification scheduledToast = new

Convert Toast message to text

别来无恙 提交于 2019-12-02 01:29:17
How can I convert this TOAST message to voice in Android? Example Toast.makeText(MainActivity.this, "I am enter code here" +positive[+ position]+ " always", Toast.LENGTH_SHORT).show(); First import the package import android.speech.tts.TextToSpeech; Then initialize private TextToSpeech tts; tts = new TextToSpeech(this, this); Finally make a function like this private void speakOut() { String text = txtText.getText().toString(); tts.speak(text, TextToSpeech.QUEUE_FLUSH, null); } Woops. I forgot, you'll also need to define an onInit function public void onInit(int status) { if (status ==