Okay I got the "Source" of the error: the try and catch returned that the Null Pointer Exception derives from this part as you already suspected:
ViewStub stub = (ViewStub) findViewById(R.id.stub_exposure); importStub = stub.inflate(); But I don't understand why it should be null as I followed the examples I found on the web... e.g. this here: http://developer.android.com/reference/android/view/ViewStub.html And this is the code in the xml, in which I call the ViewStub: <ViewStub android:id="@+id/stub_exposure" android:inflatedId="@+id/stub_exposure_view" android:layout="@layout/exposureview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#77000000"> </ViewStub> And here is the according layout xml for the inflated View, the exposureview.xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@+String/hello" ></TextView> <SeekBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:thumb="@drawable/seek_thumb" android:progress="50" android:max="100"> </SeekBar> </RelativeLayout> 2010/8/1 Victoria Busse <victoriasarabu...@gmail.com> > mhmmm, I tried > > try{ > btnExposure.setOnClickListener(new OnClickListener() > { > > @Override > public void onClick(View v) { > > ViewStub stub = (ViewStub) findViewById(R.id.stub_exposure); > importStub = stub.inflate(); > > } > });}catch (Exception e){ > Log.e("ERROR", "Error in Code:" +e.toString()); > } > > but I don't get any output at all... > > 2010/8/1 Kostya Vasilyev <kmans...@gmail.com> > >> Victoria, >> >> Judging by logcat, it looks like "stub" variable, the result of calling >> findViewById(R.id.stub_exposure) is null. You should check this in the >> debugger. >> >> -- Kostya >> >> 01.08.2010 13:46, Victoria Busse пишет: >> >> Okay found the problem, I simply forgot to define the button's >> View btnExposure = (ImageButton) findViewById(R.id.button_exposure); >> So this - quite simple - problem's solved, but now I got at new >> NullPointerException at >> com.mobilevideoeditor.moved.EditorView$1.onClick(EditorView.java:54), which >> is importStub = ((ViewStub) findViewById(R.id.stub_exposure)).inflate(); >> And this is what I don't really understand because I am not familiar >> with ViewStubs yet... >> >> I also tried ViewStub stub = (ViewStub) >> findViewById(R.id.stub_exposure); >> importStub = stub.inflate(); >> but again I get the Null Pointer Exception at importStub = >> stub.inflate(); >> >> Could there be s.th wrong with the exposureview.xml that I use to >> inflate the stub?? >> >> >> 2010/8/1 Victoria Busse <victoriasarabu...@gmail.com> >> >>> Here is the Logcat: >>> >>> 08-01 08:17:11.984: ERROR/AndroidRuntime(223): Uncaught handler: thread >>> main exiting due to uncaught exception >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): >>> java.lang.RuntimeException: Unable to start activity >>> ComponentInfo{com.mobilevideoeditor.moved/com.mobilevideoeditor.moved.EditorView}: >>> java.lang.NullPointerException >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> android.app.ActivityThread.access$2200(ActivityThread.java:119) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> android.os.Handler.dispatchMessage(Handler.java:99) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> android.os.Looper.loop(Looper.java:123) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> android.app.ActivityThread.main(ActivityThread.java:4363) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> java.lang.reflect.Method.invokeNative(Native Method) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> java.lang.reflect.Method.invoke(Method.java:521) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> dalvik.system.NativeStart.main(Native Method) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): Caused by: >>> java.lang.NullPointerException >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> com.mobilevideoeditor.moved.EditorView.onCreate(EditorView.java:49) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): at >>> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) >>> 08-01 08:17:11.994: ERROR/AndroidRuntime(223): ... 11 more >>> >>> >>> The Null pointer exception apparently is at >>> com.mobilevideoeditor.moved.EditorView.onCreate(EditorView.java:49), which >>> is the Image Button onClickListener >>> >>> >>> >>> 2010/8/1 Kostya Vasilyev <kmans...@gmail.com> >>> >>> Logcat? >>>> >>>> -- >>>> Kostya Vasilyev -- http://kmansoft.wordpress.com >>>> >>>> 01.08.2010 12:32 пользователь "Victoria Busse" < >>>> victoriasarabu...@gmail.com> написал: >>>> >>>> >>>> Update, just found a mistake within the ViewStub declaration as I forgot >>>> to specify a layout, here is the updated code because the error is still >>>> there :(( If someone knows what I am doing wrong please help me because >>>> after finding out that I forgot the layout *I thought it would work *but >>>> apparently it still doesn't >>>> >>>> <ViewStub >>>> android:id="@+id/stub_exposure" >>>> android:inflatedId="@+id/stub_exposure_view" >>>> >>>> android:layout="@layout/exposureview" >>>> >>>> >>>> android:layout_width="fill_parent" >>>> android:layout_height="fill_parent" >>>> androi... >>>> >>>> >>>> On Sun, Aug 1, 2010 at 1:11 AM, kivy <victoriasarabu...@gmail.com> >>>> wrote: >>>> > >>>> > Hi there, >>>> > >>>> > I just ... >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Android Developers" g... >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Android Developers" group. >>>> To post to this group, send email to >>>> android-developers@googlegroups.com >>>> To unsubscribe from this group, send email to >>>> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> >>>> For more options, visit this group at >>>> http://groups.google.com/group/android-developers?hl=en >>>> >>> >>> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-developers@googlegroups.com >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> >> >> >> -- >> Kostya Vasilev -- WiFi Manager + pretty widget -- >> http://kmansoft.wordpress.com >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-developers@googlegroups.com >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en