Java Question @ActivityObject and exposed methods/properties

alwaysbusy

Expert
Licensed User
Longtime User
This is something I have since I created libraries for B4A and I wondering if there was a way to hide default methods/properties within B4A.

e.g. I'm now creating a new lib for youtube. In Java I have:
B4X:
@ActivityObject
@ShortName("ABYoutube")
@Version(1.04f)
@Author("Alain Bailleul")
@Events(values={"Initialized(Success as Boolean, Message as String)"})
@Permissions(values={"android.permission.INTERNET"})
@DependsOn(values={"youtubeandroidplayerapi"})
public class ABYoutube extends YouTubeBaseActivity implements OnInitializedListener {
...

The library works fine, except in B4A I see a lot of methods/properties that should not be visible to the developer like:

ACCESSIBILITY_SERVICE
ACCOUNT_SERVICE
ActionBar
ACTIVITY_SERVICE
addContentView
ALARM_SERVICE
APP_OPS_SERVICE
Application
ApplicationContext
ApplicationInfo
applyOvverrideConfiguarion
Assets
AUDIO_SERVICE
BaseContext
BIND_ABOVE_CLIENT
BIND_ADJUST_WITH_ACTIVIY
.... and hundreds more

I know you can use @Hide to hide methods you wrote yourself. But how do you hide these 'Default' methods/properties?

I added @ActivityObject to the title of this post as I'm under the impression I see more of those 'Defaults' in B4A when I have to use @ActivityObject.

Note: This library also needs #Extends: com.ab.abyoutube.ABYoutube in B4A
 

moster67

Expert
Licensed User
Longtime User
Maybe it is the interface which creates problems?
Is it possible in your source-code to assign some of the methods as private and then write separate setters/getters methods?

Just thinking out loud....
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is not related to @ActivityObject.

If I were to create this wrapper I wouldn't have exposed this class at all.

Instead expose a different class with the methods required (and still use #Extends to extend this class).

You can hide methods that belong to the parent by overriding the methods.
For example:
B4X:
@Hide
@Override
public void someMethod() {
  super.someMethod();
}
 

MarcoRome

Expert
Licensed User
Longtime User
Hi , i have some problem, but i dont understand what i do.
I have this code in java:

B4X:
package com.devil.signature;

import java.lang.Object;
import android.app.Activity;
import android.content.Context;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import android.os.Bundle;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
import android.util.Base64;
import android.util.Log;


import anywheresoftware.b4a.*;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.Permissions;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.*;


@Version(1.0f)
@ShortName("CheckSignature")
@Author("Devil-App")


/**
*
* @author Devil-App
*
*/

public class CheckSignature extends Activity{
private BA ba;


public static String getPackageName(final BA ba) {
        return ba.applicationContext.getPackageName();
    }

  
public String HashKey(String namepackage) {
......

all work but when i go into B4A i see a lot of methods/properties.



Thanks
Marco
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…