B4A Library Library Create ShortLink

Discussion in 'Additional libraries, classes and official updates' started by MarcoRome, Jul 20, 2015.

  1. MarcoRome

    MarcoRome Expert Licensed User

    Hi all.

    This is simple library create ShortLink.
    I used this free service: PSBE:CO

    Is very simple:

    ShortLink
    Author:
    Devil-App
    Version: 1.02
    • ShortLink
      Methods:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Initialize (url As String, yourkey As String, Module As Object, EventName As String) As String


        For get your Key HERE

        Code:
        Sub Activity_Create(FirstTime As Boolean)
            
        'Do not forget to load the layout file created with the visual designer. For example:
            'Activity.LoadLayout("Layout1")
            Dim createshortlink As ShortLink
            
        Dim url As String
            url = 
        "https://www.google.it/search?sclient=psy-ab&biw=1600&bih=775&site=webhp&q=link+molto+lunghi+ma+molto+molto+lunghi&oq=link+molto+lunghi+ma+molto+molto+lunghi&gs_l=hp.3...1985656.1989803.0.1990495.22.14.0.0.0.0.0.0..0.0....0...1c.1.64.psy-ab..22.0.0.BN3qzQhL1aY&pbx=1&bav=on.2,or.r_cp.&bvm=bv.98197061,d.bGQ&ion=1&ech=1&psi=DKqsVY_pAcKtygPz_pjYAw.1437379086446.7&ei=DaqsVbuaDcjXygO3qK_oCA&emsg=NCSR&noj=1"
            createshortlink.Initialize(url,
        "Fe5pwHzYKdmshHMC2Kq7NUIN0X3Ap1J54u4jsn62nFgdNmBJX9", Me, "check_short")
           
        End Sub

        Sub check_short(valore As typeLevel)
        LogColor(valore.link, 
        Colors.Red)
        ToastMessageShow(valore.link, True)
        Msgbox(valore.link, "Messaggio")
        End Sub
        LIBRARY
        - Unzip the attached file ( ShortLink-Lib.zip ) and copy ShortLink.jar and ShortLink.xml to the libraries folder
        - ShortLink-Example.zip is simple B4A

        Screenshot 2015-07-20 10.37.45.png
     

    Attached Files:

    Last edited: Apr 20, 2016
  2. ArminKH

    ArminKH Well-Known Member

    great and useful lib thank u 4 sharing :)
     
    MarcoRome likes this.
  3. imgsimonebiliato

    imgsimonebiliato Well-Known Member Licensed User

    Got this error log.
    Please help:

    Code:
    Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 30914 (config)
    java.lang.NoClassDefFoundError: anywheresoftware.b4a.http.HttpClientWrapper


        at anywheresoftware.b4a.samples.httputils2.httputils2service._process_globals(httputils2service.java:
    137)
        at b4a.example.main.initializeProcessGlobals(main.java:
    335)
        at b4a.example.main.afterFirstLayout(main.java:
    94)
        at b4a.example.main.access$
    100(main.java:16)
        at b4a.example.main$WaitForLayout.run(main.java:
    76)
        at android.os.Handler.handleCallback(Handler.java:
    725)
        at android.os.Handler.dispatchMessage(Handler.java:
    92)
        at android.os.Looper.loop(Looper.java:
    153)
        at android.app.ActivityThread.main(ActivityThread.java:
    5297)
        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:
    833)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
    600)
        at dalvik.system.NativeStart.main(Native Method)
     
  4. MarcoRome

    MarcoRome Expert Licensed User

    Try add okHTTP library
     
    DonManfred likes this.
  5. imgsimonebiliato

    imgsimonebiliato Well-Known Member Licensed User

    I've tried but don't change.
     
  6. MarcoRome

    MarcoRome Expert Licensed User

    Ok, you have in #1 Update Library (1.02)
     
  7. imgsimonebiliato

    imgsimonebiliato Well-Known Member Licensed User

    Thank you @MarcoRome ,
    but I still have this error log.

    I updated the library, added the reference to library okHttp, but:


    Code:
    java.lang.NoClassDefFoundError: anywheresoftware.b4a.objects.ServiceHelper$StarterHelper
        at devil.app.shortlink.httputils2service.onCreate(httputils2service.java:
    48)
        at android.app.ActivityThread.handleCreateService(ActivityThread.java:
    2671)
        at android.app.ActivityThread.access$
    1600(ActivityThread.java:156)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
    1422)
        at android.os.Handler.dispatchMessage(Handler.java:
    99)
        at android.os.Looper.loop(Looper.java:
    153)
        at android.app.ActivityThread.main(ActivityThread.java:
    5297)
        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:
    833)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
    600)
        at dalvik.system.NativeStart.main(Native Method)
     
  8. MarcoRome

    MarcoRome Expert Licensed User

    In libraries Folder you see ShortLink 1.02 ??
     
  9. imgsimonebiliato

    imgsimonebiliato Well-Known Member Licensed User

  10. MarcoRome

    MarcoRome Expert Licensed User

    First that you try ricompile go menu Tools --> Clean Project
     
  11. imgsimonebiliato

    imgsimonebiliato Well-Known Member Licensed User

  12. MarcoRome

    MarcoRome Expert Licensed User

    Look this demo that i done 2 minutes ago ( with new library )

     
  13. imgsimonebiliato

    imgsimonebiliato Well-Known Member Licensed User

    Maybe it is because I use b4a 3.82?
     
  14. MarcoRome

    MarcoRome Expert Licensed User

    Is time for Upgrade :D
     
    DonManfred and imgsimonebiliato like this.
  15. so27

    so27 Active Member Licensed User

    What is the API, which to choose?
     
  16. so27

    so27 Active Member Licensed User

    Code:
    createshortlink.Initialize(url,"Fe5pwHzYKdmshHMC2Kq7NUIN0X3Ap1J54u4jsn62nFgdNmBJX9", Me, "check_short")
    This
    Fe5pwHzYK...
    Key.

    2016-04-23_08h57_31.png
     
  17. MarcoRome

    MarcoRome Expert Licensed User

    What mean... targetSdkVersion or what ?
     
  18. so27

    so27 Active Member Licensed User

    You write:
    2016-04-23_08h59_54.png
    And there are thousands of APIs. What I have to choose because since. What is the name of the API? Under psbe nothing is found. SDK is clear.
     
  19. MarcoRome

    MarcoRome Expert Licensed User

    Hi so27, are you a few nervous today ?
    For first thing i like when people start with "Hi"....
    Hi you have picture:

    Immagine.jpg

    You try Click about link point 1, here you have 2 link :

    First link --> Psbe.co, here you have official site, so you see documentation and information
    Second Link --> Mashape, if in mashape you dont found nothing maybe it was deleted.

    Anyway the key that you have in Example work. You can use this .

    Nice day
     
  20. so27

    so27 Active Member Licensed User

    Ahhhh, okay. Is the service because even available for free? Is there something you known?
     
Loading...