how to start an activity defined in java library

fenoglio

New Member
Licensed User
Longtime User
hello everyone,

my basic4android app has to start an activity defined in java library.

i've built a java library and sucessfully imported in basic4android. The library contains just a public class that extends android.app.Activity.

@ShortName("DemoLibActivity")
public class DemoLibActivity extends Activity {
...

i need to use this libray in my basic4android app and i need to perform a startActivityForResult. for instance, i'm able to use the library in other java class like as

public class MainAppActivity extends Activity {
...
final Context ctx = getBaseContext();
Intent intent = new Intent(ctx, DemoLibActivity.class);
startActivityForResult(intent,requestCode);
...

but i don't know how to translate these three lines in b4a.

any solutions?

regards
 

fenoglio

New Member
Licensed User
Longtime User
do you mean put an AndroidManifest.xml in java library that contains the activity that is called by b4a app?
ok but, how i can perform the startActivityForResult on this activity from b4a app?

in summary, i've an existing b4a app and from here i want call an activity located in a external library; this activity shows a login form, then performs a request to protected web services and then returns the response for b4a app. I've tried to simulate the behavior of b4a app building a mockup in java and the startActivityForResult works fine as defined in my first post; in that case the called activity is defined in AndroidManifest.xml located in java mockup.

thank for the support.
 
Upvote 0

fenoglio

New Member
Licensed User
Longtime User
all within one app. this app is built using b4a. this app imports a java library that contains just an activity, a class that extends android.app.Activity. i need or would to perform a startActivityForResult, in b4a code, on this activity.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
do you mean put an AndroidManifest.xml in java library that contains the activity that is called by b4a app?
No. You should add the declaration to the manifest editor in the B4A project.

You cannot call startActivityForResult directly from B4A. The library should call it as described in the link I posted.
 
Upvote 0

xiaoyao

Member
Licensed User
Longtime User
No. You should add the declaration to the manifest editor in the B4A project.

You cannot call startActivityForResult directly from B4A. The library should call it as described in the link I posted.

i also has this question:

package com.youmi.android.addemo;

import net.youmi.android.AdManager;
import net.youmi.android.spot.SplashView;
import net.youmi.android.spot.SpotDialogListener;
import net.youmi.android.spot.SpotManager;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;

public class SplashSpotActivity extends Activity {


i only use *.jar file,with out xml file.how can i use this activity?
public class SplashSpotActivity extends Activity {

i use this to load the jar:#AdditionalJar: YoumiSdk
 
Upvote 0
Top