Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 检测dot42中的ContextChanged事件_Android_Dot42 - Fatal编程技术网

Android 检测dot42中的ContextChanged事件

Android 检测dot42中的ContextChanged事件,android,dot42,Android,Dot42,我希望我的应用程序中有一个EditText字段来响应ContextChange事件,以便在文本更改时调用一个方法。我正在使用dot42制作应用程序,但只能找到Java版的教程 在Java中,可以通过实现TextWatcher接口来实现。 说 AddTextChangedListener(ITextWatcher watcher) Adds a TextWatcher to the list of those whose methods are called whenever this Text

我希望我的应用程序中有一个EditText字段来响应ContextChange事件,以便在文本更改时调用一个方法。我正在使用dot42制作应用程序,但只能找到Java版的教程

在Java中,可以通过实现TextWatcher接口来实现。 说

AddTextChangedListener(ITextWatcher watcher)

Adds a TextWatcher to the list of those whose methods are called whenever this TextView's text changes.` 

因此,在
postertextchanged
中执行一些操作,就可以了。

在Java中,可以通过实现一个TextWatcher接口来实现。 说

AddTextChangedListener(ITextWatcher watcher)

Adds a TextWatcher to the list of those whose methods are called whenever this TextView's text changes.` 

所以实现,在
修改后的
中执行一些操作,就可以了。

这将是一个最小的实现。我希望它能帮助您看到Java和C#之间的区别——这真是微不足道

   [Activity]
   public class MainActivity : Activity, Android.Text.ITextWatcher
   {
      protected override void OnCreate(Bundle savedInstance)
      {
         base.OnCreate(savedInstance);
         SetContentView(R.Layouts.MainLayout);

         EditText editText = FindViewById<EditText>(R.Ids.status);
         editText.AddTextChangedListener(this);
      }

      public void AfterTextChanged(Android.Text.IEditable s)
      {
         throw new NotImplementedException();
      }

      public void BeforeTextChanged(Java.Lang.ICharSequence s, int start, int count, int after)
      {
         throw new NotImplementedException();
      }

      public void OnTextChanged(Java.Lang.ICharSequence s, int start, int before, int count)
      {
         throw new NotImplementedException();
      }
   }
[活动]
公共类MainActivity:Activity,Android.Text.ITextWatcher
{
受保护的重写void OnCreate(Bundle savedInstance)
{
base.OnCreate(savedInstance);
SetContentView(R.Layouts.mainloayout);
EditText EditText=findviewbyd(R.id.status);
editText.AddTextChangedListener(此);
}
public void afterextchanged(Android.Text.IEditable s)
{
抛出新的NotImplementedException();
}
public void BeforeTextChanged(Java.Lang.ICharSequence s、int start、int count、int after)
{
抛出新的NotImplementedException();
}
public void OnTextChanged(Java.Lang.ICharSequence s,int start,int before,int count)
{
抛出新的NotImplementedException();
}
}

接口实现由VisualStudio生成

这将是一个最小的实现。我希望它能帮助您看到Java和C#之间的区别——这真是微不足道

   [Activity]
   public class MainActivity : Activity, Android.Text.ITextWatcher
   {
      protected override void OnCreate(Bundle savedInstance)
      {
         base.OnCreate(savedInstance);
         SetContentView(R.Layouts.MainLayout);

         EditText editText = FindViewById<EditText>(R.Ids.status);
         editText.AddTextChangedListener(this);
      }

      public void AfterTextChanged(Android.Text.IEditable s)
      {
         throw new NotImplementedException();
      }

      public void BeforeTextChanged(Java.Lang.ICharSequence s, int start, int count, int after)
      {
         throw new NotImplementedException();
      }

      public void OnTextChanged(Java.Lang.ICharSequence s, int start, int before, int count)
      {
         throw new NotImplementedException();
      }
   }
[活动]
公共类MainActivity:Activity,Android.Text.ITextWatcher
{
受保护的重写void OnCreate(Bundle savedInstance)
{
base.OnCreate(savedInstance);
SetContentView(R.Layouts.mainloayout);
EditText EditText=findviewbyd(R.id.status);
editText.AddTextChangedListener(此);
}
public void afterextchanged(Android.Text.IEditable s)
{
抛出新的NotImplementedException();
}
public void BeforeTextChanged(Java.Lang.ICharSequence s、int start、int count、int after)
{
抛出新的NotImplementedException();
}
public void OnTextChanged(Java.Lang.ICharSequence s,int start,int before,int count)
{
抛出新的NotImplementedException();
}
}

接口实现由VisualStudio生成

你试过什么了吗,至少是的,我试过了。但是没有帮助。如果你知道怎么做,请分享,请阅读问题。我想用dot42而不是java来做。你试过什么了吗,至少我试过了。但是没有帮助。如果你知道怎么做,请分享,请阅读问题。我想用dot42而不是java来实现它。我阅读了文档,但没有提供帮助。如果有,请分享示例代码。我没有任何示例代码。你试着按照我的建议去做了吗?您是否使用自定义ITextWatcher调用myTextView.AddTextChangedListener?我阅读了文档,但没有提供帮助。如果有,请分享示例代码。我没有任何示例代码。你试着按照我的建议去做了吗?你用自定义ITextWatcher调用myTextView.AddTextChangedListener了吗?如果可能的话,我会给你1000分。。。我是这个问题的专家如果可能的话我会给你1000分。。。我在这个问题上花了好几个小时