Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NPE on hallo world code

 
Giovanni Montano
Ranch Hand
Posts: 248
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All despite I am trying since 4 days, I cannot make a string recognizable by Java, the emulator crashes, and I showed it to several senior developers and they cannot help me, despite the code is really easy
thank you


this is the fragment_main.xml


and this is the logcat error

 
Maneesh Godbole
Saloon Keeper
Posts: 11329
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

this is the fragment_main.xml

Does this seem right?
 
Giovanni Montano
Ranch Hand
Posts: 248
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Maneesh,thank you i would say not is not right, but only because i would suppose it is not because otherwise you would not ask me.
unfortunately, I do not understand, with some common sense I would say not. but I do not understand what you mean.
Yesterday with common sense I thought:" ehy under res layout there are two files activity_main and fragment_main, so I tried to use the graphical editor to drag some text( but it looked not feasible because all the buttons and widgets I was dragging where overlapping one on top of the other), and eclipse open me as defaulti this fragment main, so probably also if I write in main, as I do not see inside the code another place where to write I should put it in fragment!"

probably I was wrong, but still I do not undestand what I should do now to make it work, i am really newbe sorry
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you posted fragment_main I'm guessing you assumed it would be used, correct? If so, then the problem is what Maneesh noticed - your code actually uses activity_main. So you should fix that.

But activity_main seems to exist, because if it didn't, you would have gotten a compiler error. So if you are not using that, you should delete it to head off any further confusion.
 
Giovanni Montano
Ranch Hand
Posts: 248
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you now is working
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic