Java Question first library = disaster :)

oscarsarrio

Member
Licensed User
Longtime User
I first created the project in eclipse and I tested with the emulator working correctly ... Just when openthe program shows you the keyboard selection dialog .. I followed the steps to create the video library from Erel (perfect all) ... But when I roll with the library added B4a jumps me error, the Java code of the library is:

package lowboyman.lib.keyboard;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.view.inputmethod.InputMethodManager;
import anywheresoftware.b4a.BA.ShortName;

@ShortName ("show_keyboard")

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);
//((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);


}

public int hazlo(int x){

InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showInputMethodPicker();
x=1;
return x;

}
}


B4A code:

#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim sk As show_keyboard

End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.

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")
sk.hazlo(1)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Any idea? greetings
 
Last edited:

oscarsarrio

Member
Licensed User
Longtime User
Not really but I do not care if you do not believe the activity gives me an error in : showInputMethodPicker();



:sign0104:
 

oscarsarrio

Member
Licensed User
Longtime User
I use Android Developer Tools whith eclipse Platform ... Not compatible?? Regarding the settings are those that came out in the program with the compilation of java 1.6 ... :BangHead:
 

oscarsarrio

Member
Licensed User
Longtime User
Thanks for help Erel, I reinstalled eclipse and seems no longer gives me these errors ... But still functions ... I get an error when starting the application B4A with the library, the log:

LogCat connected to: emulator-5554
** Activity (main) Create, isFirst = true **


main_activity_create (java line: 233)


java.lang.NullPointerException


at androis.primera.libreria.keyboard_show.hazlo(keyboard_show.java:20)
at b4a.example.main._activity_create(main.java:233)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at b4a.example.main.afterFirstLayout(main.java:85)
at b4a.example.main.access$100(main.java:16)
at b4a.example.main$WaitForLayout.run(main.java:72)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException


** Activity (main) Resume **


Program eclipse:



:sign0013:
 
Top