B4A Library AnswerView

Enjoy this project from B4A https://github.com/buraktamturk/AnswerView

A library mimics the circles used in optic forms.

screenanswer1.png



AnswerView
Author:
SMM
Version: 0.01
  • AnswerView
    Events:
    • _answerchanged (answerview1 As AnswerView, index As Int)
    Fields:
    • ba As BA
    Methods:
    • BringToFront
    • Initialize (EventName As String, count As Int, ShowTextWhenActive As Boolean, changeOnClick As Boolean, canCancelAnswer As Boolean, ShowNumber As Boolean)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • resize (count As Int)
    Properties:
    • ActiveChar As Char
    • ActiveIndex As Int
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Number As Int [write only]
    • Parent As Object [read only]
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int


Sample (Not the best of course :D)


B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim finished As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
   

'   

    For i = 0 To 5
        Dim ans As AnswerView
        ans.Initialize("an",5,True,True,True,True)
        ans.Number=i+1
        ans.Tag=i+1
       
        If i Mod 2 = 1 Then
            ans.Color=Colors.White
        Else
            ans.Color=Colors.LightGray
        End If
        Activity.AddView(ans,0,(0+10%y*i),100%x,10%y)
    Next
    finished.Initialize("finished")
    finished.Text="Finished"
    Activity.AddView(finished,0,90%y,100%x,10%y)
End Sub
Sub finished_click
    Dim unanswered As List
    unanswered.Initialize
   
    For v=0 To  Activity.NumberOfViews-1
   
        If Activity.GetView(v) Is AnswerView Then
           
            Dim vv As AnswerView = Activity.GetView(v)
            If vv.ActiveChar="@" Then
                unanswered.Add(vv.Tag)
            End If

        End If
    Next
    If unanswered.Size=0 Then
        ToastMessageShow("You have answered all questions , Good luck",False)
    Else
        For un = 0 To unanswered.Size-1
            ToastMessageShow("Please answer question number "&unanswered.Get(un),False)
        Next
       
    End If
End Sub
Sub an_answerchanged(ans As AnswerView,index As Int)
    Dim send As AnswerView = Sender
    Log(send.ActiveChar&index&send.Tag)

End Sub
 

Attachments

  • AnswerView.zip
    10.2 KB · Views: 214
  • answerview_res.zip
    2.5 KB · Views: 188

paragkini

Member
Licensed User
Longtime User
:) Thanks for such a prompt response.

Before posting only I had checked in the link you provided from GitHub whether its available.
there are two but I am not sure which one is correct. I am not a Java guy and hence can't help myself.
Please see if you can help me. I am trying to create a customized android app for my children to practice their primary school studies.

QuestionViewer

QuestionViewTest

Thanks in advance...
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
:) Thanks for such a prompt response.

Before posting only I had checked in the link you provided from GitHub whether its available.
there are two but I am not sure which one is correct. I am not a Java guy and hence can't help myself.
Please see if you can help me. I am trying to create a customized android app for my children to practice their primary school studies.

QuestionViewer

QuestionViewTest

Thanks in advance...
Sorry but I don't think these are question view libraries .
 
Top