Questions tagged [charsequence]

In Java (and related languages such as Scala), java.lang.CharSequence is an interface to sequences of character values.

For more information, see the Java 8 specification of CharSequence.

146 questions
0
votes
3 answers

convert charSequence elements into enum elements

In AndroidStudio , I've made a list containing colors to select from using AlertDialog.builder. I stored the colors in charSequence like this CharSequence colors[] = new CharSequence[] {"Red1" , "Green1", "Blue1"}; so far so good. Now I've made a…
Noam
  • 1,640
  • 4
  • 26
  • 55
0
votes
3 answers

How do I use the contains method with "if, else" statement?

I am having difficulty triggering my "if" statement. When I input "I like my 'anything'", which the CharSequence should be searching for, the code kicks out the error from the else statement. I've tried to see if the contains method wasn't reading…
ucodebro3
  • 1
  • 1
  • 1
  • 1
0
votes
1 answer

Implement CharSequence in order to use String.join?

I have a collection of objects that all override toString(). I want to write them out to console or concatenate to a string, basically creating a toString() for the collection. I can use a for loop to achieve this. String.join() seems to be a much…
null
  • 5,207
  • 1
  • 19
  • 35
0
votes
3 answers

Search for CharSequences between two CharSeqeunces (Java)

first of all I want to say, that I'm a noobie in Java. (Sorry if the answer is that easy). I have a String, which contains following text: String htmlContent = "DienstagfälltMittwochfällt"; Now I have 3 CharSequences: CharSequence dt =…
alexanders916
  • 157
  • 1
  • 16
0
votes
1 answer

Not visualizing byte[] in snackbar

I am sending and receiving data from an android app to an arduino using the USB. The data I receive from the Arduino is in byte[] form: UsbSerialInterface.UsbReadCallback mCallback = new UsbSerialInterface.UsbReadCallback() { //Defining a Callback…
Alvaro
  • 1,430
  • 2
  • 23
  • 41
0
votes
2 answers

CharSequence[] to CharSequance

I am using the library material dialogs. The multi list uses CharSequence[] instead of CharSequence. @Override public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) { // If Bold// if…
Jordan
  • 407
  • 5
  • 20
0
votes
2 answers

How can I control a EditText in Android to don't enter the same number twice?

I tried with Using TextChangedListener, beforeTextChanged and afterTextChanged! but I had no result
Chawki Messaoudi
  • 714
  • 2
  • 6
  • 18
0
votes
4 answers

Java with Selenium WebDriver

I am trying to automate gmail login. When I enter the text in username input box using sendKeys() it is throwing an exception. My code: WebElement userName = driver.findElement(By.id("Email")); userName.sendKeys("tutorial"); Exception:…
Vini R
  • 1
  • 2
0
votes
2 answers

Android - The method is undefined

I keep getting this error while trying to convert to CharSequence[]. The method toArray(CharSequence[]) is undefined for the type String This is my code CharSequence[] cs = abbrev.toArray(new CharSequence[abbrev.length()]); The…
BasicCoder
  • 99
  • 1
  • 2
  • 9
0
votes
4 answers

How to use a string id from res/values/strings.xml instead of String or CharSequence?

If I have this piece of code with hardcoded String "New event of importance": public class MainActivity extends Activity { private NotificationManager mNManager; private static final int NOTIFY_ID = 1100; @Override public void…
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
0
votes
0 answers

What is label used for in "public static final CharSequence getTypeLabel (Resources res, int type, CharSequence label)"?

I am trying to load my contacts into a ListView. I had no idea where to start, so I searched the www and found some examples. One of them (https://github.com/codepath/android_guides/wiki/Loading-Contacts-with-Content-Providers) describes the…
Vic Torious
  • 1,757
  • 3
  • 21
  • 24
0
votes
1 answer

Is there any difference initializing array by enumaration XOR new type[] + enumaration?

Is there any difference between those to initializations of array? CharSequence colors[] = new CharSequence[] {"red", "green", "blue", "black"}; CharSequence colors[] = {"red", "green", "blue", "black"};
Yoda
  • 17,363
  • 67
  • 204
  • 344
0
votes
1 answer

Extracting sequence of column names for Shiny

I am constructing an RShiny app and am trying to generate the checkboxGroupInput options in an efficient manner. I'd like to create a vector with every odd column name to avoid doing the below to generate the potential options for the user to…
Z_D
  • 797
  • 2
  • 12
  • 30
0
votes
0 answers

Is this sending the right value back? Not working in test Java

SO i made a CharSequence[] array with all the two consecutive uppercase letters. Why is this code not returning the correct values? public static boolean containConsecCaps(String passw) { CharSequence[] consec = {"AA","AB","AC","AD","AE","AF",…
Daniel Anner
  • 112
  • 10
0
votes
2 answers

Finding text change in EditText using TextWatcher

I'm trying to get what modification user has made to EditText, either insert or delete. I use TextWatcher but I don't get right result, moreover sometimes "getChar(start, end) has end before start" error. editText = (EditText)…
Arch1tect
  • 4,128
  • 10
  • 48
  • 69