问题标签 [charsequence]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
53 浏览

android - 如何更改文本视图的 android:text

我无法更改文本视图中的文本。我想让 textview 包含字符串“foo \n bar \n foo2 \n bar2”,并且我希望能够在 textview 中添加和删除行。我可以在 android:text 中手动输入“foo \n bar”,但我想从我的类文件中编辑它并附加从字符串的 ArrayList 添加的项目。

它想要接受一个 CharSequence,但是从 String 转换为 CharSequence 似乎并不那么开心。

0 投票
1 回答
2239 浏览

button - 运算符 + 不能应用于 java.lang.charsequence

尝试做一个计算器,这里是带有 * 的行运行时的按钮方法,它出现错误“operator + cannot be applied to java.lang.charsequence”。如果有人知道解决此问题的方法,请提供帮助。

谢谢

0 投票
1 回答
100 浏览

java - 在 MALLET Java API 中,为什么 Input2CharSequence 管道不能输入 CharSequenceLowercase() 管道?

当我尝试连续使用这些管道时,出现错误:

线程“main”中的异常 java.lang.IllegalArgumentException:CharSequenceLowercase 需要一个字符串,找到了一个类 java.lang.StringBuffer

我在 MALLET 中没有看到任何可用的管道来解决这个问题。但在我看来 CharSequenceLowercase() 应该能够接受 CharSequence ...

0 投票
0 回答
122 浏览

android - “public static final CharSequence getTypeLabel (Resources res, int type, CharSequence label)”中使用的标签是什么?

我正在尝试将我的联系人加载到 ListView中。我不知道从哪里开始,所以我搜索了 www 并找到了一些示例。其中之一(https://github.com/codepath/android_guides/wiki/Loading-Contacts-with-Content-Providers)很好地描述了这种方法。现在我根本不明白,这个标签是干什么用的。

我试图重现该示例并使用

CharSequence mailType = ContactsContract.CommonDataKinds.Email.getTypeLabel(context.getResources(), type, null);

代替

CharSequence emailType = ContactsContract.CommonDataKinds.Email.getTypeLabel(context.getResources(), type, customLabel);

正如示例中所示,每一个对我来说似乎都很好。那么这个标签是干什么用的呢?

提前致谢!

0 投票
4 回答
499 浏览

android - 如何使用 res/values/strings.xml 中的字符串 id 而不是 String 或 CharSequence?

如果我有这段带有硬编码字符串“重要的新事件”的代码:

但想将其移动到res/values/string.xml文件中:

那么如何R.strings.new_event在上面的构造函数中使用(是的,我知道构造函数已被弃用)?

请再问一个问题 - 为什么final上面使用关键字?

0 投票
3 回答
954 浏览

java - 根据字数对字符串列表进行排序

我有一个文件,它将每一行转储到 ArrayList 中的一个位置,我希望用户能够对列表进行排序,使其只有具有一定数量单词的行。我不知道如何让它打印剩余的列表(正确编号的条目)。

它首先找到列表中的第一个单词,然后遍历 CharSequence 并检查字符是否等于空格,如果是,则将 nWords 递增 1,如果 nWords 不等于 userInput(用户输入按字数对列表进行排序),它应该从列表中删除该项目。

0 投票
1 回答
507 浏览

android - Android Volley Converting ArrayList to CharSequence Returning Empty

In the onCreate method, I have a network operation that is to return JSON that is parsed into ArrayLists, to be set into a CharSequence[] array and used in an alert dialog.

However, when selected, the alert does not populate with the resulting JSON data. Thus far, I know the Volley implementation works and the data is passed into the ArrayLists. The area of failure is passing the ArrayList data into the CharSequence[] array that is then to be passed into the AlertDialog:

I think the failure has to do with the time for the network operation to finish and the populating of the AlertDialog.

How can I get the nested AlertDialog to be populated with the data?

0 投票
2 回答
74 浏览

android - Android - 方法未定义

我在尝试转换为 CharSequence [] 时不断收到此错误。

字符串类型的 toArray(CharSequence[]) 方法未定义

这是我的代码

缩写只是将句子分成第一个字符(Hello World --> HW)

有任何想法吗?

谢谢

0 投票
4 回答
2197 浏览

java - Java 与 Selenium WebDriver

我正在尝试自动化 gmail 登录。

当我在用户名输入框中输入文本时,使用sendKeys()它会引发异常。

我的代码:

例外:

0 投票
2 回答
79 浏览

android - 如何控制 Android 中的 EditText 不输入两次相同的数字?

我尝试使用 TextChangedListener、beforeTextChanged 和 afterTextChanged!但我没有结果