File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes reading XML layout contains a SurfaceView Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "reading XML layout contains a SurfaceView " Watch "reading XML layout contains a SurfaceView " New topic
Author

reading XML layout contains a SurfaceView

Dov Ezra
Greenhorn

Joined: Nov 23, 2010
Posts: 21
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
Marshal

Joined: Mar 22, 2005
Posts: 39529
    
  27
There should be a stacktrace in the logcat output; post that here.


Ping & DNS - updated with new look and Ping home screen widget
Dov Ezra
Greenhorn

Joined: Nov 23, 2010
Posts: 21
How do I view the logcat output on netbeans? or eclipse?
Dov Ezra
Greenhorn

Joined: Nov 23, 2010
Posts: 21
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
Marshal

Joined: Mar 22, 2005
Posts: 39529
    
  27
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

Joined: Nov 23, 2010
Posts: 21
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.
 
 
subject: reading XML layout contains a SurfaceView
 
Similar Threads
nullpointer when i try to initiate onclicklistener
how to put button inside a SurfaceView and on the bootom of the screen?
Why error in this code
Keyboard events for EditText not reaching my event handler.
odd framelayout/surfaceview problem