Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/224.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 设置EditText的文本时,应用程序崩溃_Android_Android Edittext - Fatal编程技术网

Android 设置EditText的文本时,应用程序崩溃

Android 设置EditText的文本时,应用程序崩溃,android,android-edittext,Android,Android Edittext,为什么每当我试图更改EditText的文本时,我的应用程序总是崩溃?我试过了 celc=(EditText)findViewById(R.id.cel); far=(EditText)findViewById(R.id.fa); Ran=(EditText)findViewById(R.id.Ran); 开尔文=(编辑文本)findviewbyd(R.id.kev) celc.addTextChangedListener(新的TextWatcher(){ 也许您没有将视图对象与java对象链接

为什么每当我试图更改EditText的文本时,我的应用程序总是崩溃?我试过了 celc=(EditText)findViewById(R.id.cel); far=(EditText)findViewById(R.id.fa); Ran=(EditText)findViewById(R.id.Ran); 开尔文=(编辑文本)findviewbyd(R.id.kev)
celc.addTextChangedListener(新的TextWatcher(){


也许您没有将视图对象与java对象链接

您使用findViewById方法进行了此操作

您的布局文件:

<EditText ... android:id="@+id/edittext" />
在方法onCreate上:

        edittext = (EditText) findViewById(R.id.editText);

致以最诚挚的问候!

也许您没有将视图对象与java对象链接起来

您使用findViewById方法进行了此操作

您的布局文件:

<EditText ... android:id="@+id/edittext" />
在方法onCreate上:

        edittext = (EditText) findViewById(R.id.editText);

致以最诚挚的问候!

也许您没有将视图对象与java对象链接起来

您使用findViewById方法进行了此操作

您的布局文件:

<EditText ... android:id="@+id/edittext" />
在方法onCreate上:

        edittext = (EditText) findViewById(R.id.editText);

致以最诚挚的问候!

也许您没有将视图对象与java对象链接起来

您使用findViewById方法进行了此操作

您的布局文件:

<EditText ... android:id="@+id/edittext" />
在方法onCreate上:

        edittext = (EditText) findViewById(R.id.editText);
致以最良好的祝愿

  • 在xml文件中声明EditText
  • 在活动中查找编辑文本
  • 在编辑文本中设置文本
  • 如果您检查文档中的EditText,您会发现一个settText()方法。它接受一个字符串和一个TextView.BufferType。例如:

    EditText editText =     (EditText)findViewById(R.id.edit_text);
    editText.setText("Google is your friend.", TextView.BufferType.EDITABLE); 
    
    或使用+,字符串连接运算符:

     ed = (EditText) findViewById (R.id.box);
        int x = 10;
        ed.setText(""+x);
    

  • 在xml文件中声明EditText
  • 在活动中查找编辑文本
  • 在编辑文本中设置文本
  • 如果您检查文档中的EditText,您会发现一个settText()方法。它接受一个字符串和一个TextView.BufferType。例如:

    EditText editText =     (EditText)findViewById(R.id.edit_text);
    editText.setText("Google is your friend.", TextView.BufferType.EDITABLE); 
    
    或使用+,字符串连接运算符:

     ed = (EditText) findViewById (R.id.box);
        int x = 10;
        ed.setText(""+x);
    

  • 在xml文件中声明EditText
  • 在活动中查找编辑文本
  • 在编辑文本中设置文本
  • 如果您检查文档中的EditText,您会发现一个settText()方法。它接受一个字符串和一个TextView.BufferType。例如:

    EditText editText =     (EditText)findViewById(R.id.edit_text);
    editText.setText("Google is your friend.", TextView.BufferType.EDITABLE); 
    
    或使用+,字符串连接运算符:

     ed = (EditText) findViewById (R.id.box);
        int x = 10;
        ed.setText(""+x);
    

  • 在xml文件中声明EditText
  • 在活动中查找编辑文本
  • 在编辑文本中设置文本
  • 如果您检查文档中的EditText,您会发现一个settText()方法。它接受一个字符串和一个TextView.BufferType。例如:

    EditText editText =     (EditText)findViewById(R.id.edit_text);
    editText.setText("Google is your friend.", TextView.BufferType.EDITABLE); 
    
    或使用+,字符串连接运算符:

     ed = (EditText) findViewById (R.id.box);
        int x = 10;
        ed.setText(""+x);
    


    我们怎么知道既没有代码也没有堆栈跟踪?所以我要说“是小精灵干的”。请提供一个演示您的问题的示例。在这种情况下,请发布堆栈跟踪中引用的代码。输入您的logcat错误。Android RunTime@deepakgoyal我们应该如何知道既没有代码也没有堆栈跟踪?所以我将使用“小精灵做到了”。请提供一个演示您的问题的示例。在这种情况下,请发布堆栈跟踪中引用的代码。输入您的logcat错误。Android RunTime@deepakgoyal我们应该如何知道既没有代码也没有堆栈跟踪?所以我将使用“小精灵做到了”。请提供一个演示您的问题的示例。在这种情况下,请发布堆栈跟踪中引用的代码。输入您的logcat错误。Android RunTime@deepakgoyal我们应该如何知道既没有代码也没有堆栈跟踪?所以我将使用“小精灵做到了”。请提供一个演示您的问题的示例。在这种情况下,请发布,以及堆栈跟踪中引用的代码。将您的logcat错误放入日志。Android RunTime@DeepakGoyal