Android Question EditText scroll

Status
Not open for further replies.

Fadi-l

Member
Hi...

I'm new to B4A , I've a question please

how can I show the scroll bars ( vertical and horizontal ) ofthe EditText ( multi lines )

thank you ...
 

mangojack

Expert
Licensed User
Longtime User
what error do you get ? see logs ...

post some code to show how you use that code
[code] insert paste code here .. [/code]
 
Upvote 0

Luiz Fernando Orlandini

Active Member
Licensed User
Longtime User
what error do you get ? see logs ...

post some code to show how you use that code
[code] insert paste code here .. [/code]
No errors in the logs, APP just crash, what sounds weird.

I used the same piece of code

B4X:
Dim jo As JavaObject = edtMessage
jo.RunMethod("setScrollbarFadingEnabled", Array (False))

Any thoughts?
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
No errors in the logs, APP just crash, what sounds weird.
I used the same piece of code
You should have seen the Error .. Logs tab > Connect.

the error is : java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ScrollBarDrawable.setAlpha(int)' on a null object reference.

Hopefully someone can offer help soon.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Shouldn't
B4X:
jo.RunMethod("setScrollbarFadingEnabled", Array (False))
actually be
B4X:
jo.RunMethod("setScrollbarFadingEnabled", Array As Object(False))
?

- Colin.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
It's the same thing, when you pass an array without declaration it will be an array of object
Oh - OK, I didn't know that. I always declare it explicitly...

I don't think it's the EditText because I tried it on an EditText where I can successfully execute
B4X:
jo.RunMethod("setFocusableInTouchMode", Array As Object(True))
However if I switch it to
B4X:
jo.RunMethod("setScrollbarFadingEnabled", Array As Object(False))
I get the java.lang.NullPointerException error.

- Colin.
 
Upvote 0

canalrun

Well-Known Member
Licensed User
Longtime User
I tried the JavaObject code shown above, because I'd really like to have scrollbars in my EditText.

I also got the NullPointerException error, but it seemed to reference a pointer to a scrollbar that did not exist. I'm guessing that the EditText does not have an embedded scrollbar object.

I did a Google search and a found a StackOverflow similar question. The response seemed to say that a res XML file needs to be modified to include a vertical scrollbar in the EditText object:

http://stackoverflow.com/questions/6555986/android-how-to-set-scrollbar-in-edittext


But, modifying res XML files is beyond my capability.

Hopefully someone can confirm and describe how this is done.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Nobody found a solution to this?

I get the same error:

B4X:
java.lang.NullPointerException
    at android.view.View.onDrawScrollBars(View.java:11820)
    at android.view.View.draw(View.java:14186)
    at android.view.View.draw(View.java:14064)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3024)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2893)
    at android.view.View.draw(View.java:14062)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3024)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2893)
    at android.view.View.draw(View.java:14062)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3024)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2893)
    at android.view.View.draw(View.java:14183)
    at android.widget.FrameLayout.draw(FrameLayout.java:467)
    at android.widget.ScrollView.draw(ScrollView.java:2386)
    at android.view.View.draw(View.java:14064)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3024)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2893)
    at android.view.View.draw(View.java:14062)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3024)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2893)
    at android.view.View.draw(View.java:14062)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3024)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2893)
    at android.view.View.draw(View.java:14062)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3024)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2893)
    at android.view.View.draw(View.java:14183)
    at android.widget.FrameLayout.draw(FrameLayout.java:467)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2453)
    at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2541)
    at android.view.ViewRootImpl.draw(ViewRootImpl.java:2435)
    at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2303)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2109)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1179)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4861)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
    at android.view.Choreographer.doCallbacks(Choreographer.java:562)
    at android.view.Choreographer.doFrame(Choreographer.java:532)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
    at android.os.Handler.handleCallback(Handler.java:725)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5293)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
    at dalvik.system.NativeStart.main(Native Method)
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I know the thread is old... but is there a solution for this?
Take a look at the B4XLongTextTemplate in B4xViews library.:
 
Upvote 0
Status
Not open for further replies.
Top