I'm on the 1.0 SDK and I'm having the exact same problem... I spent a
few hours on the forums & googling, but the only suggestion I can find
is to make sure you call setContentView(...) before you call
findViewById. I can't seem to get past this -- I can't lookup any of
my views from onCreate. Posting relevant portion of main activity --
am I doing anything stupid/wrong here?
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button btn = (Button)this.findViewById(R.id.btn_about); /*
RuntimeException here */
if(btn != null)
{
return; /* set a breakpoint here*/
}
}
Thanks
Sam
On Nov 19, 11:23 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Start by downloading the current SDK 1.0. Then take a look at the
> sample code posted on this forum.
>
> On Nov 19, 12:29 am, Dagger <[EMAIL PROTECTED]> wrote:
>
> > Some one help I am using 0.9 SDK
>
> > On Nov 19, 12:58 pm, Dagger <[EMAIL PROTECTED]> wrote:
>
> > > I am having the same problem but I am only implementing the Activity
> > > Class which is included in the package by default.
> > > THis is the partial code.
>
> > > public class ActiveOctave extends Activity implements OnErrorListener,
> > > OnBufferingUpdateListener, OnCompletionListener,
> > > OnPreparedListener, SurfaceHolder.Callback {
>
> > > private static final String TAG = "VideoPlayer";
> > > private MediaPlayer mp;
> > > private SurfaceView mPreview;
> > > private EditText mPath;
> > > private SurfaceHolder holder;
> > > private ImageButton mPlay;
> > > private ImageButton mPause;
> > > private ImageButton mReset;
> > > private ImageButton mStop;
> > > private String current;
> > > /**
> > > * Called when the activity is first created.
> > > */
> > > public void onCreate(Bundle savedInstanceState) {
> > > super.onCreate(savedInstanceState);
>
> > > setContentView(R.layout.main);
> > > // Set up the play/pause/reset/stop buttons
> > > mPreview = (SurfaceView) findViewById(R.id.surface);
> > > mPath = (EditText) findViewById(R.id.path);
> > > mPlay = (ImageButton) findViewById(R.id.play);
> > > mPause = (ImageButton) findViewById(R.id.pause);
> > > mReset = (ImageButton) findViewById(R.id.reset);
> > > mStop = (ImageButton) findViewById(R.id.stop);
>
> > > This is my Debug Stack.
> > > Thread [<3> main] (Suspended (exception RuntimeException))
> > > ActivityThread.performLaunchActivity(ActivityThread
> > > $ActivityRecord)
> > > line: 2131
> > > ActivityThread.handleLaunchActivity(ActivityThread
> > > $ActivityRecord)
> > > line: 2147
> > > ActivityThread.access$1800(ActivityThread, ActivityThread
> > > $ActivityRecord) line: 112
> > > ActivityThread$H.handleMessage(Message) line: 1572
> > > ActivityThread$H(Handler).dispatchMessage(Message) line: 88
> > > Looper.loop() line: 123
> > > ActivityThread.main(String[]) line: 3708
> > > Method.invokeNative(Object, Object[], Class, Class[], Class,
> > > int,
> > > boolean) line: not available [native method]
> > > Method.invoke(Object, Object...) line: 492
> > > ZygoteInit$MethodAndArgsCaller.run() line: 734
> > > ZygoteInit.main(String[]) line: 492
> > > NativeStart.main(String[]) line: not available [native method]
>
> > > Please help what to Do.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---