Found the problem when exception raised on change orientation.
The scrollview hosted on static tab host. Tab host threw exception after
orientation change.
But still exist the original scroll problem.

On Sat, Jan 17, 2009 at 10:01 PM, Evgeny V <[email protected]> wrote:

>  The scroll bar of view is not a reason of exception.
> The app failed when i'm trying to change orientation.
>   On Sat, Jan 17, 2009 at 4:27 PM, EvgenyV <[email protected]> wrote:
>
>>
>> Hi all,
>>
>> I'm trying to set vertical scrollbar programmatically. But get
>> following error stack on creation:
>>
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):
>> java.lang.NullPointerException
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.view.View.onDrawScrollBars(View.java:4684)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.view.View.draw(View.java:5490)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.widget.FrameLayout.draw(FrameLayout.java:324)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.view.ViewGroup.drawChild(ViewGroup.java:1436)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1208)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.view.View.draw(View.java:5355)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.widget.FrameLayout.draw(FrameLayout.java:324)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.view.ViewGroup.drawChild(ViewGroup.java:1436)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1208)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.view.ViewGroup.drawChild(ViewGroup.java:1434)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1208)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.view.View.draw(View.java:5355)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.widget.FrameLayout.draw(FrameLayout.java:324)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> com.android.internal.policy.impl.PhoneWindow$DecorView.draw
>> (PhoneWindow.java:1701)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.view.ViewRoot.draw(ViewRoot.java:980)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.view.ViewRoot.performTraversals(ViewRoot.java:829)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.view.ViewRoot.handleMessage(ViewRoot.java:1103)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.os.Handler.dispatchMessage(Handler.java:88)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.os.Looper.loop(Looper.java:123)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> android.app.ActivityThread.main(ActivityThread.java:3742)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> java.lang.reflect.Method.invokeNative(Native Method)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> java.lang.reflect.Method.invoke(Method.java:515)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
>> (ZygoteInit.java:739)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
>> 01-17 13:33:12.944: ERROR/AndroidRuntime(464):     at
>> dalvik.system.NativeStart.main(Native Method)
>>
>> There is a very simple java code and xml layout:
>> public class BBB extends Activity
>> {
>>           @Override
>>            public void onCreate(Bundle savedInstanceState) {
>>                   super.onCreate(savedInstanceState);
>>                   setContentView(R.layout.bbb);
>>
>>
>>                int orient =
>> getWindow().getWindowManager().getDefaultDisplay
>> ().getOrientation();
>>                if(orient== 1)
>>                {
>>                        ScrollView viewMain = (ScrollView)findViewById
>> (R.id.layoutInputs1);
>>                        viewMain.setVerticalScrollBarEnabled(true);
>>                }
>>
>>           }
>>
>> }
>>
>> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android";
>>    android:orientation="vertical"
>>    android:layout_width="fill_parent"
>>    android:layout_height="fill_parent"
>>    android:id="@+id/layoutInputs1"
>>    android:scrollbars="none"
>>
>> >
>>
>> <LinearLayout
>>    android:layout_width="fill_parent"
>>    android:layout_height="fill_parent"
>>        android:orientation="vertical"
>>        android:id="@+id/layoutInputs2"
>>        >
>>
>> <TextView
>>            style="?android:attr/listSeparatorTextViewStyle"
>>            android:text="test-test-test"
>>            android:textColor="#FFFFFF"
>>        android:layout_width="wrap_content"
>> android:layout_height="wrap_content"/>
>>        </LinearLayout>
>> </ScrollView>
>>
>> Looks like I'm missing somethind...
>> Any ideas?
>>
>> Thanks in advance,
>> Evgeny
>>
>>
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to