• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

reading XML layout contains a SurfaceView

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic