Android Question error in b4xtable

Emerito

Active Member
Licensed User
Longtime User
In the following code:

Sub Activity_Create(FirstTime As Boolean)

Label1.Initialize("")
Label1.Top=0dip
Label1.Left=0dip
EditText1.Initialize("")
EditText1.Top=10dip
EditText1.Left=Label1.Width
EditText1.Height=30dip

IME.Initialize("ime")
IME.AddHeightChangedEvent

Activity.LoadLayout("Tabla")
Activity.Title=Main.ProgName & " " & Main.ProgVersion

Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Pulgadas", B4XTable1.COLUMN_TYPE_TEXT)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Milimetros", B4XTable1.COLUMN_TYPE_TEXT)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("DENOMINACION", B4XTable1.COLUMN_TYPE_TEXT)
StateColumn.Width = 380dip
StateColumn.Sortable = True
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Grains", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Gramos", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("CB", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("V0", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("V50", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("V100", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("V150", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("V200", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("V250", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("V300", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Visor", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Alt50", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Alt100", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Alt150", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Alt200", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Alt250", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Alt300", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Energ0", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Energ50", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Energ100", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Energ150", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Energ200", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Energ250", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Energ300", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("DS", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip
Dim StateColumn As B4XTableColumn = B4XTable1.AddColumn("Id", B4XTable1.COLUMN_TYPE_NUMBERS)
StateColumn.Width = 60dip

Msgbox("So far alright","")

Sleep(0)

NumberColumn = B4XTable1.AddColumn("Interesting Number", B4XTable1.COLUMN_TYPE_NUMBERS)
NumberColumn.Width=1dip

B4XTable1.RowHeight=50dip
B4XTable1.MaximumRowsPerPage=10

B4XTable1.pnlHeader.Height=Activity.Height/8

Msgbox("Here does not come","")

On some mobile, not all, causes the following error:

Notificar error
java.lang.NoSuchFieldException: No field
mColorStateList in class Landroid/graphics/drawable/
GradientDrawable$GradientState; (declaration of 'andro
id.graphics.drawable.GradientDrawable$GradientState'
appears in /system/framework/framework.jar)
at java.lang.Class.getDeclaredField(Native Method)
at
anywheresoftware.b4a.objects.B4XViewWrapper.getColor(
B4XViewWrapper.java:388)
at
b4a.example3.customlistview._designercreateview(custom
listview.java:305)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at
anywheresoftware.b4a.objects.CustomViewWrapper.After
DesignerScript(CustomViewWrapper.java:67)
at
anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout
(LayoutBuilder.java:162)
at
anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(
PanelWrapper.java:134)
at
anywheresoftware.b4a.objects.B4XViewWrapper.LoadLayo
ut(B4XViewWrapper.java:292)
at
deCazaV2.Monteria.b4xtable$ResumableSub_DesignerCre
ateView.resume(b4xtable.java:1371)
at
anywheresoftware.b4a.keywords.Common$13.run(Comm
on.java:1705)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:
100)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.iava:

please could you help me?

a greeting
 

mangojack

Expert
Licensed User
Longtime User
1. Post code using code Tags ... [Code] Paste code here... [/Code]

2. Do Not use Msgbox (" ....." ,"") to test problems . Use Log(" Here does not come")

3. Replace the following ...
B4X:
 B4XTable1.pnlHeader.Height=Activity.Height/8

with
B4X:
B4XTable1.HeadersHeight = DipToCurrent( Activity.Height/8)

*although I did not get an error with your line , I seem to recall earlier problem using pnlHeader.

Your Header Height calculation is a bit odd , maybe rethink calculation. On my phone it was half the screen height ??


PS: I think your Error is caused by something else ( maybe to do with Column) . If you still have problem maybe Upload Sample project.
File > Upload as Zip
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Thinking more ...

B4X:
B4XTable1.pnlHeader.Height=Activity.Height/8
Or
B4X:
B4XTable1.HeadersHeight = DipToCurrent( Activity.Height/8)


Should be moved further down , After the table has been loaded.
B4X:
Dim data As List = parser.Parse(..............)
B4XTable1.SetData(data)
   
Sleeep(0)
B4XTable1.HeadersHeight = DipToCurrent( Activity.Height/8)
 
Upvote 0

Emerito

Active Member
Licensed User
Longtime User
1. Ok
2. It happens on a mobile that is not within my reach, for mine I use log. I use Msgbox for the user to give me some clue. trying to figure out which line the error occurs. what's more, it doesn't happen on the user's wife's mobile phone and if it happens on your mobile..
3. I test your suggestions

Please excuse my english.
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
 
Upvote 0

eps

Expert
Licensed User
Longtime User
 
Upvote 0

Emerito

Active Member
Licensed User
Longtime User
Thanks to both. I have put the targetSdkVersion in 28. I will check if it works correctly for my friend.
 
Upvote 0
Top