Android Question Start Activity From Library of Java with (#if JAVA)

adolfo

Member
Licensed User
(warwound Expert, example) ( with add #if JAVA, inside B4A)[ the original was make for compile the lib outside B4A]

is it possible?

B4X:
#if JAVA
package uk.co.martinpearman.b4a.googlemapview;

import android.os.Bundle;
import anywheresoftware.b4a.BA.DependsOn;
import anywheresoftware.b4a.BA.Hide;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

@DependsOn(values = { "maps" })
@Hide
public class MyMapView extends MapActivity {
    [USER=69643]@override[/USER]
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        MapView mapView = new MapView(this, "0k1SIJwKfCiZzLeQxv6UEHoTeHXJzmX7uYlDXUg");
        setContentView(mapView);
    }
   [USER=69643]@override[/USER]
   protected boolean isRouteDisplayed() {
      return false;
   }
}
#end if
B4X:
#if JAVA
package uk.co.martinpearman.b4a.googlemapview;

import android.content.Intent;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.ActivityObject;
import anywheresoftware.b4a.BA.Author;
import anywheresoftware.b4a.BA.Permissions;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;

@ActivityObject
@Author("Martin Pearman")
@Permissions(values = { "android.permission.INTERNET" })
@ShortName("IntentCreator")
@Version(1.0f)
public class IntentCreator {
   public Intent GetIntent(BA pBA){
      return new Intent(pBA.activity, MyMapView.class);
   }
}
#end if
if will possible it, how will be the code for used ( referrer below) I know I will need ( supposed) Dim jo As JavaObject = Me... for beginnig..... I'm new, sorry!

B4X:
Sub Process_Globals
End Sub

Sub Globals
   Dim Test As IntentCreator
End Sub

Sub Activity_Create(FirstTime As Boolean)
   StartActivity(Test.GetIntent)
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub
Thaks
 

adolfo

Member
Licensed User
You are member since 5 years...
No, I try, but not!... I real beginning, 2 month ago ( I bought the app before, but to complicated my work, didn't let me begin)!..... but went be close to terminate my first app, I get a bad new ( I need some out to fix the last one step, not too complicate if you know java( not my case)) and the inline , it didn't no help me! I checked it before ask!

Thanks , appreciated your time

( I try to create [public class MainActivity extends Activity] to handle [ protected void onStart() ] and send of it [.dispatchTouchEvent(event);] ... I try to open for send email of a intent and the extension of activity take care to touch the button to send( no human intervention))
 

adolfo

Member
Licensed User
That will be the way to send the touch
B4X:
int[] coordinates = new int[2];
myView.getLocationOnScreen(coordinates);

// MotionEvent parameters
long downTime = SystemClock.uptimeMillis();
long eventTime = SystemClock.uptimeMillis();
int action = MotionEvent.ACTION_DOWN;
int x = coordinates[0];
int y = coordinates[1];
int metaState = 0;

// dispatch the event
MotionEvent event = MotionEvent.obtain(downTime, eventTime, action, x, y, metaState);
myView.dispatchTouchEvent(event);
 
Top