Muneeb Muneeb - 1 year ago 71
Android Question

Combining two CharSequence variables

Can I combine two

variables like this?

if (status == 1) {
for (int i = 0; i < get.length(); i++) {
if (get.charAt(i) == ')') {
} else {
temp = temp.toString() + get.charAt(i);
// temp and get are charSequence VARIABLES

Syntax is looking OK as no errors from compiler, but the app is crashing.

Also I don't want to get in
items at this beginner stage. Any idea what I am doing wrong?

Also if you say that I shouldn't use
method then I understand but what should I do then to make it correct?

Answer Source

are you sure get is not null ?

i tried your code and it's working.

debug and provide values for which your app is crashing.

and you can achieve the same result with :

temp = temp.toString() + get.toString().replaceAll("\\)", "");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download