是否有一种强大的方法来检测Thread.currentThread()
应用程序中的Android系统UI线程是否存在?
我想在我的模型代码中放置一些断言,断言只有一个线程(例如 ui线程)访问我的状态,以确保不需要任何类型的同步.
这里的简短问题:
在.Net 4.0 Winforms中,如何使用a的PasswordChar
属性Textbox
将常见的黑点显示为字符?是否有一些我可以使用的字体作为一个字符?
如果我使用' UseSystemPasswordChar = true
'它会显示一个星号(*).
如何在不按键盘键的情况下触发按键事件?我试过这里的解决方案,但我得到以下异常:
'System.Windows.PresentationSource.FromVisual(System.Windows.Media.Visual)'的最佳重载方法匹配具有一些无效参数.
考虑Shift+A包含键盘上的2键按键事件,如何在不按键盘的情况下执行此操作?(让我们只需在按钮单击的文本框中打印大写字母A)
我的代码
var key = Key.A; // Key to send
var target = Keyboard.FocusedElement; // Target element
var routedEvent = Keyboard.KeyDownEvent; // Event to send
target.RaiseEvent(new System.Windows.Input.KeyEventArgs(Keyboard.PrimaryDevice, System.Windows.PresentationSource.FromVisual(target), 0, key) { RoutedEvent = routedEvent });
Run Code Online (Sandbox Code Playgroud) 我使用了github的系统通知插件(https://github.com/saileshmittal/phonegap-system-notification-plugin)来获取android phonegap.我在index.html中使用了这段代码
我的代码是:
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
var not_title = 'Message';
var not_text = 'Zou dit werken?';
var not_tText = 'Message';
navigator.systemNotification.onBackground();
navigator.systemNotification.onForeground();
navigator.systemNotification.createStatusBarNotification(not_title, not_text, not_tText);
}
Run Code Online (Sandbox Code Playgroud)
我在前台和后台都获得了通知图标.但是,当在应用程序中单击按钮并持续调用我的wcf服务时,可以运行整个应用程序在后台运行.即使在运行时我也需要获取警报在后台如何做到这一点?
navigator.systemNotification.onBackground()
:此行在后台运行应用程序,或者不是其他方式,仅用于在关闭应用程序后显示通知.
请指导我,提前谢谢.
在本教程之后,我正在WP8.I代码中进行语音识别的示例程序,如:
public async void SpeechToText_Click(object sender, RoutedEventArgs e)
{
SpeechRecognizerUI speechRecognition=new SpeechRecognizerUI();
SpeechRecognitionUIResult recoResult=await speechRecognition.RecognizeWithUIAsync();
if (recoResult.ResultStatus == SpeechRecognitionUIStatus.Succeeded)
{
MessageBox.Show(string.Format("You said {0}.", recoResult.RecognitionResult.Text));
}
}
Run Code Online (Sandbox Code Playgroud)
运行程序后,我总是面对一条消息" 我们很抱歉,但我们现在无法访问网络 ",一个声音说.
是否需要互联网连接?我检查我的互联网连接但是它很好,那么问题是什么,有人可以解释吗?这是模拟器问题还是我错过了什么?
我有一个使用datagridview的vb.net Windows窗体应用程序.我希望找到一种简单的方法来格式化某些datagridview单元格数字最多3位小数.这是我到目前为止所做的,但似乎并没有正确地格式化所有内容.
DataGridView1.Columns(3).DefaultCellStyle.Format = "#.###"
Run Code Online (Sandbox Code Playgroud) 我正在通过Android的手势进行手写字母检测的样本工作.当我一次输入1个字符时效果很好.这意味着当我通过手势在屏幕上写A时,程序会很好地识别它(因为我之前将它放在手势库上).截至目前我的代码是这样的.
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
ArrayList<Prediction> predictions = gLib.recognize(gesture);
if (predictions.size() > 0 && predictions.get(0).score > 1.0) {
String letter = predictions.get(0).name;
Toast.makeText(this, letter, Toast.LENGTH_SHORT).show();
if(letter.contains("A")) //when matches i print it to edittext
edittext.setText("A");
.
. //rest of stuff here like previous way
.
}
}
Run Code Online (Sandbox Code Playgroud)
但我的标准不是那样.我想认识一个字.我想一次写一个单词.
在为每次成功的比赛写一个单词时,应该在edittext上打印相应的字母.
A,N,D,R,O,I,D
Run Code Online (Sandbox Code Playgroud)
所以我的问题是如何才能获得它?是否可以分割手势(在写作时对单词进行分段)?任何工作代码示例或链接都将受到赞赏.
是否有一个很好的教程或链接,显示如何将不同的项添加到列表视图?
例如,一个有两个文本行和一个复选框,另一个你只是按,并弹出一些东西.我现在所有的每个列表项都是相同的两行文本视图和复选框...
或者,如果有一种方法可以一次添加1行,具有不同的布局通过R.layout.xxx
?
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mRoot = inflater.inflate(R.layout.frag_settings, container, false);
mItems = getResources().getStringArray(R.array.setting_items);
mItemDescription = getResources().getStringArray(R.array.setting_item_descriptions);
mItemListView = (ListView) mRoot.findViewById(R.id.lvMainListView);
ArrayAdapter<String> lvRowTitle = new ArrayAdapter<String>(getActivity(),
R.layout.setting_twolinetext_checkbox, R.id.tvRowTitle,
mItems);
mItemListView.setAdapter(lvRowTitle);
ArrayAdapter<String> lvRowDesc = new ArrayAdapter<String>(getActivity(),
R.layout.setting_twolinetext_checkbox, R.id.tvRowDesc,
mItemDescription);
mItemListView.setAdapter(lvRowDesc);
return mRoot;
Run Code Online (Sandbox Code Playgroud) 是否可以从正在运行的应用程序中替换模板库的手势模板?我正在建立一个手写识别系统,其中手势库文件中有字母模板.所以基本上在代码中加载库后我比较用户输入手势,如:
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
ArrayList<Prediction> predictions = gesturelib.recognize(gesture);
if (predictions.size() > 1) {
for(Prediction prediction: predictions){
//i compare prediction name here and if matches print it in an edittext
}
Run Code Online (Sandbox Code Playgroud)
这应该工作得很好,直到用户给出与我在构建库模板期间所做的相同的模式.但是我想让用户在预测不匹配时灵活地用他的手写模式替换模板项.
因为下面2个手写的手势样本在模式方面有所不同,而不是作为一个字母.假设,我的系统支持第一个图像模式,我想当用户给出第二个图像模式时系统会要求用户确认将其替换为A的库模式然后在确认之后将其替换.所以下次系统将更好地识别用户模式.
任何帮助将不胜感激.
我已经看到很多关于这个的老问题,也许现在有一些解决方案.我想截取我的视频的当前帧的截图.Videoview使用rtsp-stream显示实时视频.
我尝试采用位图,但它始终是黑色的
public static Bitmap loadBitmapFromView(View v) {
Bitmap b = Bitmap.createBitmap(v.getLayoutParams().width , v.getLayoutParams().height, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
v.layout(0, 0, v.getLayoutParams().width, v.getLayoutParams().height);
v.draw(c);
return b;
}
Run Code Online (Sandbox Code Playgroud)
编辑:
MediaMetadataRetriever
不适用于流网址,也许适用于视频文件.在此链接上使用lib (它MediaMetadataRetriever
是启用rtsp协议输入的包装)我可以保存一帧视频,但实时视频视图有10秒的延迟,因为它必须与流服务器建立新连接.
我没有测试 ThumbnailUtils
,但在Api我读到输入只是文件路径
android ×5
c# ×3
.net ×1
cordova ×1
datagridview ×1
format ×1
gestures ×1
handwriting ×1
java ×1
javascript ×1
jquery ×1
textbox ×1
vb.net ×1
winforms ×1
wpf ×1