EDIT : PLEASE forget it !
The initialize of the ListView was missing
Sorry
Alain
Hi All
I want to add a ListView under the Main activity of CameraEx example at the level of the picture size Button and effect button.
The code works fine for the effect button. i get all the supported effects but for the image size button I get a java error (see log)
My code for the button is:
The behavior is weird as the picture size listview (LvPSize) begins to display only 3 values and then the debugger stops....
The same code for the effect button works like a charm :
I cannot figure out where is my mistake ? Is there an interaction between the cameraEx picturesize function and Listview ?
Thanks
Alain
PackageAdded: package:Aeropic.CameraUnlock
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (unlock) Create **
** Service (unlock) Start **
** Activity (main) Pause, UserClosed = true **
** Activity (second) Create, isFirst = true **
** Activity (second) Resume **
90
[Height=720, IsInitialized=false, Width=960
]
second_btnpicturesize_click (B4A line: 211)
Activity.AddView(LvPSize,0, btnPictureSize.Height, 40%x, 60%y)
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.view.ViewGroup.addViewInner(ViewGroup.java:3618)
at android.view.ViewGroup.addView(ViewGroup.java:3489)
at android.view.ViewGroup.addView(ViewGroup.java:3465)
at anywheresoftware.b4a.objects.ActivityWrapper.AddView(ActivityWrapper.java:119)
at Aeropic.CameraUnlock.second._btnpicturesize_click(second.java:560)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:158)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:154)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:64)
at android.view.View.performClick(View.java:4211)
at android.view.View$PerformClick.run(View.java:17267)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
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:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
The initialize of the ListView was missing
Sorry
Alain
Hi All
I want to add a ListView under the Main activity of CameraEx example at the level of the picture size Button and effect button.
The code works fine for the effect button. i get all the supported effects but for the image size button I get a java error (see log)
My code for the button is:
B4X:
Sub btnPictureSize_Click
Dim pictureSizes() As CameraSize = camEx.GetSupportedPicturesSizes
Dim current As CameraSize = camEx.GetPictureSize
LvPSize.Color = Colors.black
LvPSize.SingleLineLayout.ItemHeight = 25dip
LvPSize.SingleLineLayout.Label.TextSize = 15
For i = 0 To pictureSizes.Length-1
'Msgbox(pictureSizes(i).Width&"x"&pictureSizes(i).Height,"")
LvPSize.AddSingleLine(pictureSizes(i).Width&"x"&pictureSizes(i).Height)
Next
Activity.AddView(LvPSize,0, btnPictureSize.Height, 40%x, 60%y)
....
The behavior is weird as the picture size listview (LvPSize) begins to display only 3 values and then the debugger stops....
The same code for the effect button works like a charm :
B4X:
Sub btnEffect_Click
Dim effects As List = camEx.GetSupportedColorEffects
If effects.IsInitialized = False Then
ToastMessageShow("Effects not supported.", False)
Return
End If
LvEffect.Color = Colors.black
LvEffect.SingleLineLayout.ItemHeight = 25dip
LvEffect.SingleLineLayout.Label.TextSize = 15
For i = 0 To effects.Size-1
LvEffect.AddSingleLine(effects.Get(i))
Next
Activity.AddView(LvEffect,btnEffect.Left, btnEffect.Height, 40%x, 60%y)
End Sub
Sub LvEffect_ItemClick (Position As Int, Value As Object)
camEx.ColorEffect=LvEffect.GetItem(Position)
'ToastMessageShow(LvEffect.GetItem(Position), False)
camEx.CommitParameters
LvEffect.clear
LvEffect.RemoveView
End Sub
Sub LvPSize_ItemClick (Position As Int, Value As Object)
LvPSize.clear
LvPSize.RemoveView
End Sub
I cannot figure out where is my mistake ? Is there an interaction between the cameraEx picturesize function and Listview ?
Thanks
Alain
PackageAdded: package:Aeropic.CameraUnlock
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (unlock) Create **
** Service (unlock) Start **
** Activity (main) Pause, UserClosed = true **
** Activity (second) Create, isFirst = true **
** Activity (second) Resume **
90
[Height=720, IsInitialized=false, Width=960
]
second_btnpicturesize_click (B4A line: 211)
Activity.AddView(LvPSize,0, btnPictureSize.Height, 40%x, 60%y)
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.view.ViewGroup.addViewInner(ViewGroup.java:3618)
at android.view.ViewGroup.addView(ViewGroup.java:3489)
at android.view.ViewGroup.addView(ViewGroup.java:3465)
at anywheresoftware.b4a.objects.ActivityWrapper.AddView(ActivityWrapper.java:119)
at Aeropic.CameraUnlock.second._btnpicturesize_click(second.java:560)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:158)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:154)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:64)
at android.view.View.performClick(View.java:4211)
at android.view.View$PerformClick.run(View.java:17267)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
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:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
Last edited: