小编rid*_*doy的帖子

如何在Android上检测UI线程?

是否有一种强大的方法来检测Thread.currentThread()应用程序中的Android系统UI线程是否存在?
我想在我的模型代码中放置一些断言,断言只有一个线程(例如 ui线程)访问我的状态,以确保不需要任何类型的同步.

android

111
推荐指数
5
解决办法
3万
查看次数

哪个passwordchar在winforms文本框中显示黑点(?)?

这里的简短问题:

.Net 4.0 Winforms中,如何使用a的PasswordChar属性Textbox将常见的黑点显示为字符?是否有一些我可以使用的字体作为一个字符?

如果我使用' UseSystemPasswordChar = true'它会显示一个星号(*).

.net c# textbox winforms

70
推荐指数
5
解决办法
29万
查看次数

无需按键盘上的键即可触发键盘按键事件

如何在不按键盘键的情况下触发按键事件?我试过这里的解决方案,但我得到以下异常:

'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)

c# wpf keyboard-events

8
推荐指数
1
解决办法
3万
查看次数

如何在后台运行android phonegap应用程序(关闭应用程序后)?

我使用了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():此行在后台运行应用程序,或者不是其他方式,仅用于在关闭应用程序后显示通知.

请指导我,提前谢谢.

javascript jquery cordova

7
推荐指数
1
解决办法
9693
查看次数

Windows Phone 8中的语音识别

教程之后,我正在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)

运行程序后,我总是面对一条消息" 我们很抱歉,但我们现在无法访问网络 ",一个声音说.
是否需要互联网连接?我检查我的互联网连接但是它很好,那么问题是什么,有人可以解释吗?这是模拟器问题还是我错过了什么?

c# speech-recognition windows-phone-8

7
推荐指数
1
解决办法
1968
查看次数

如何使用vb.net将数字格式化为datagridview中的3位小数

我有一个使用datagridview的vb.net Windows窗体应用程序.我希望找到一种简单的方法来格式化某些datagridview单元格数字最多3位小数.这是我到目前为止所做的,但似乎并没有正确地格式化所有内容.

DataGridView1.Columns(3).DefaultCellStyle.Format = "#.###" 
Run Code Online (Sandbox Code Playgroud)

vb.net format datagridview

7
推荐指数
1
解决办法
5万
查看次数

Android中的手势分割

我正在通过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)

所以我的问题是如何才能获得它?是否可以分割手势(在写作时对单词进行分段)?任何工作代码示例或链接都将受到赞赏.

android gesture-recognition handwriting

5
推荐指数
1
解决办法
1679
查看次数

在列表视图中添加不同类型的项目

是否有一个很好的教程或链接,显示如何将不同的项添加到列表视图?
例如,一个有两个文本行和一个复选框,另一个你只是按,并弹出一些东西.我现在所有的每个列表项都是相同的两行文本视图和复选框...
或者,如果有一种方法可以一次添加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)

android android-listview

5
推荐指数
2
解决办法
1万
查看次数

在android中替换手势库模板

是否可以从正在运行的应用程序中替换模板库的手势模板?我正在建立一个手写识别系统,其中手势库文件中有字母模板.所以基本上在代码中加载库后我比较用户输入手势,如:

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的库模式然后在确认之后将其替换.所以下次系统将更好地识别用户模式.

任何帮助将不胜感激.

在此输入图像描述 在此输入图像描述

android gesture-recognition gestures template-matching

4
推荐指数
1
解决办法
1033
查看次数

android获取当前视频的截图

我已经看到很多关于这个的老问题,也许现在有一些解决方案.我想截取我的视频的当前帧的截图.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我读到输入只是文件路径

java android android-mediaplayer android-videoview

4
推荐指数
1
解决办法
6905
查看次数