What's wrong with my Android code?


I'm trying to write a simple Android app for my own personal use that gets basic Cpu and Memory information, but I'm only getting 1 error at the end that I can't figure out. The code is attached below, so if someone could be so kind as to show me what's wrong? I get the following error:

Multiple markers at this line
- Syntax error on token "+", delete this
token
- Syntax error on token(s), misplaced
construct(s)

On the last line:
System.out.println(cpuInfo + memInfo);

sort by: active | newest | oldest
1-10 of 17Next »
NachoMahma6 years ago
> System.out.println(cpuInfo + memInfo);
.  Apparently, "+" is not a string concatenator in Android or you have some other syntax error. But I've never used Android.
It is a valid string concatenator for Android as it's Java.

How did you store the cpu and mem info into the cpuInfo and memInfo variables?

What data type are they?

Are they the data type that println will accept?

Are they data types that can be concatenated with a + ?
.  I dunno, I've never used Android (or Java). Maybe the values are returned as arrays. Google is your friend.
Yeah, I saw that the first time, so no need to italicize, bold, and repeat.

Am I not supposed to offer correct information because someone who never used it gave incorrect information? I do program with Java and the Android framework, which is why I'm offering suggestions.

It'd be more helpful for you to pastebin the relevant code, but I'm still betting on a data type mismatch somewhere.

.  It would seem that you erroneously replied to my comment when you meant to post a top-level comment. If you have any expertise at all with the situation at hand then please (more italic and bold for ya) feel free to offer your advice - just don't reply to this post, instead, click on "Add Comment" above and that will start a new thread.
It would seem you are easily offended and your only defense to being corrected is to trash this thread with your completely irrelevant whining.

I intentionally responded to your incorrect comment to add correct information instead of responding in a separate one which could possibly be buried and detached from what I was referring to. I then added some suggestions instead of further muddling this topic with more comments.

You, however, seem to have got upset that someone corrected your incorrect statement. I have experience with Java/C/C++/C#/x86 ASM/z80 ASM/ARM ASM/VB/XNA/DirectX/Android/CSS/PHP/HTML/JS/Python and plenty more frameworks/apis/languages that I don't feel like bothering. I came here with suggestions based on actual experience and knowledge, and you came here to pull something out your rear, post it, then get upset and muck up this thread when someone corrects you.

You incorrectly assumed you can't concatenate with + in Java/Android, incorrectly assumed I missed your statement that you don't know Java/Android (and thus have no reason to respond), and now are incorrectly assuming that I don't know how to respond to a comment.

Move along now.
We have a be nice policy, take care now...
Unfortunately no policy regarding spam/trolling?
Haha, you had your first encounter with grumpy grandpa. Don't worry, stick around. Welcome to Instructables.
Thanks for the warm welcome.

I hope the hostility towards people that correct bad information isn't prevalent here.
1-10 of 17Next »