Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading XML layout contains a SurfaceView

 
Dov Ezra
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I want to build a gui with some buttons and my own surfaceView.

my XML looks like this



and in my activity I'm trying to load this layout:


but the app crush when calling setContentView.
it is also crush when I try to call
View view= this.getLayoutInflater().inflate(R.layout.main, null);
the next line here should be setContentView(view);

how this inflation should be done?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There should be a stacktrace in the logcat output; post that here.
 
Dov Ezra
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I view the logcat output on netbeans? or eclipse?
 
Dov Ezra
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I find out how to see the logcat on eclipse and how to dump it into a text file.
but Java ranch don't allow to attach text files.
so I have to paste this huge amount of text here, I guess.

Also, I attached the java and xml code for this app, so you can have the context.
I don't sure how to read this. toward the end of the log there is a report on socketException and
one line saying: "Launch timeout has expired, giving up wake lock!"
is this related to my costume surface?



 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Next time, please post just the exception stack traces.

So: Your layout uses a class me.tests.MySurf class which does not have a MySurf(Context,AttributeSet) constructor. The class should start somewhat like this:
 
Dov Ezra
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
so it just a missing constructor?
maybe, in the case where the costume view don't need parameters in the constructor,
does the version that takes only context will suffice?

The log seems to me different then the one I posted, but then I noticed that edit it.
I'll try to handle logcat better next time.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic