B4A Library ErrorView Wrapper

Is there an ErrorView in this forum ? I don't know ! This is one.https://github.com/xiprox/ErrorView
ErrorView
Version:
0.5
  • ErrorView
    Events:
    • onClick
    • onRetry
  • Fields:
    • ba As BA
  • Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • BringToFront
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • 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)
    • isRetryButtonVisible As Boolean
      Indicates whether the retry button is visible.
    • isSubtitleVisible As Boolean
      Indicates whether the subtitle is currently visible.
    • isTitleVisible As Boolean
      Indicates whether the title is currently visible.
    • showRetryButton (show As Boolean)
      Shows or hides the retry button.
    • showSubtitle (show As Boolean)
      Shows or hides error subtitle.
    • showTitle (show As Boolean)
      Shows or hides the error title
  • Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Error As Int [write only]
      Sets error subtitle to the description of the given HTTP status code
    • Height As Int
    • Image As Bitmap [write only]
      Sets the error image to a given {@link android.graphics.Bitmap}.
    • ImageBitmap As Bitmap [write only]
      Sets the error image to a given {@link android.graphics.Bitmap}.
    • Left As Int
    • RetryButtonText As String
      Returns the current retry button text.
    • RetryButtonTextColor As Int
      Returns the current retry button text color.
    • Subtitle As String
      Returns the current subtitle.
    • SubtitleAlignment As Int [write only]
      Sets the subtitle's alignment to a given value
    • SubtitleColor As Int
      Returns the current subtitle text color.
    • Tag As Object
    • Title As String
      Returns the current title string.
    • TitleColor As Int
      Returns the current title text color.
    • Top As Int
    • Visible As Boolean
    • Width As Int

What are the possible HTTP Codes Supported ?

(400, "Bad Request");
(401, "Unauthorized");
(402, "Payment Required");
(403, "Forbidden");
(404, "Not Found");
(405, "Method Not Allowed");
(406, "Not Acceptable");
(407, "Proxy Authentication Required");
(408, "Request Timeout");
(409, "Conflict");
(410, "Gone");
(411, "Length Required");
(412, "Precondition Failed");
(413, "Request Entity Too Large");
(414, "Request-URI Too Long");
(415, "Unsupported Media Type");
(416, "Requested Range Not Satisfiable");
(417, "Expectation Failed");

(500, "Internal Server Error");
(501, "Not Implemented");
(502, "Bad Gateway");
(503, "Service Unavailable");
(504, "Gateway Timeout");
(505, "HTTP Version Not Supported");
ss_01.png
 

Attachments

  • ErrorViewLib.zip
    16.6 KB · Views: 346
  • Example.zip
    20.8 KB · Views: 322
Last edited:

jahswant

Well-Known Member
Licensed User
Longtime User
B4X:
   ErrorView.Error = "404"
    ErrorView.showRetryButton(True)
    ErrorView.RetryButtonTextColor = Colors.Green
    ErrorView.RetryButtonText = "Retry"
'    ErrorView.Image = LoadBitmap(File.DirAssets,"icon.png")
'    ErrorView.isRetryButtonVisible = True
'    ErrorView.isSubtitleVisible = True
'    ErrorView.isTitleVisible = True
    ErrorView.showTitle(True)
'    ErrorView.showRetryButton(True)
    'ErrorView.Title = "Ohhh NOOO !"

Sub ErrorView_onRetry
    ToastMessageShow("Retry",True)
End Sub
Sub ErrorView_onClick
    ToastMessageShow("Clicked",True)
End Sub
 

ArminKH

Well-Known Member
WOOOOOOOOOOOOOOOOOOOOOOOOOOW
GREAT
THANK U SOOOOOOOOOOO MUCH
 

Blue.Sky

Active Member
Licensed User
Longtime User
@jahswani Hi
Thanks for your shared library
in Android lower than 4.4.4
This error Why does it happen?


B4X:
actmenu_activity_create (java line: 440)
android.view.InflateException: Binary XML file line #33: Error inflating class <unknown>
    at android.view.LayoutInflater.createView(LayoutInflater.java:606)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:459)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
    at tr.xip.errorview.ErrorView.init(ErrorView.java:78)
    at tr.xip.errorview.ErrorView.<init>(ErrorView.java:70)
    at tr.xip.errorview.ErrorView.<init>(ErrorView.java:65)
    at tr.xip.errorview.ErrorView.<init>(ErrorView.java:61)
    at tr.xip.errorview.ErrorView.<init>(ErrorView.java:57)
    at cm.jahswant.errorview.ErrorViewWrapper._initialize(ErrorViewWrapper.java:37)
    at cm.jahswant.errorview.ErrorViewWrapper.Initialize(ErrorViewWrapper.java:30)
    at ir.varzesh3.com.actmenu._activity_create(actmenu.java:440)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
    at ir.varzesh3.com.actmenu.afterFirstLayout(actmenu.java:102)
    at ir.varzesh3.com.actmenu.access$000(actmenu.java:17)
    at ir.varzesh3.com.actmenu$WaitForLayout.run(actmenu.java:80)
    at android.os.Handler.handleCallback(Handler.java:608)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:156)
    at android.app.ActivityThread.main(ActivityThread.java:4987)
    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:784)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
    at android.view.LayoutInflater.createView(LayoutInflater.java:586)
    ... 29 more
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-xhdpi-v4/error_view_retry_button_background.xml from drawable resource ID #0x7f020041
    at android.content.res.Resources.loadDrawable(Resources.java:2032)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
    at android.view.View.<init>(View.java:2812)
    at android.widget.TextView.<init>(TextView.java:500)
    at android.widget.TextView.<init>(TextView.java:490)
    ... 32 more
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #3: invalid drawable tag ripple
    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:863)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:804)
    at android.content.res.Resources.loadDrawable(Resources.java:2029)
    ... 36 more
android.view.InflateException: Binary XML file line #33: Error inflating class <unknown>
 
Last edited:
Top