将多个项目集成到单个应用程序中

Integrating Multi Projects into single app

I have three existing apps. Now i want to combine all the three into single app. Say i have three button, when i click button 1 then app 1 should run. And when button 2 is clicked app 2 should run. Is it possible in android studio? have have tried searching but nothing helped.

首先我要说我没有任何使用 Android Studio 的经验。希望它与其极其简化的 App Inventor 有一些相似之处。

任何人,我会创建一个独立的主屏幕(activity?),上面有 3 个按钮,并将三个现有应用程序的代码粘贴到同一应用程序的其他屏幕中。每个按钮都会通过打开一个新的activity.

来打开其对应的screen/app

来自这个 SO start application knowing package name。只需使用这两行,您就可以启动任何已知 package name 的已安装应用程序:

Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.example.abc");
startActivity( LaunchIntent );

对于未知的包名

PackageManager pm;
pm = getPackageManager();
//  get a list of installed apps.
packages = pm.getInstalledApplications(0);

得到解决方案。我只是将这三个应用程序转换为库并将它们导入到主应用程序中。现在我可以根据需要随时从这三个应用程序中的任何一个调用任何 activity。使用包管理时,所有三个应用程序都必须单独安装。感谢 coder 和 himty 抽出时间来回答我的问题。但我仍然有问题。我实际上正在研究表盘。即使我可以启动任何 activity,我仍然无法更改表盘。试过壁纸,但我们只能打开面部选择器,无法设置表盘。

ComponentName unique=new ComponentName(MainActivity.this,BlackOwlBlue.class);
                    Intent i=new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER)
                            .putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,unique)
                            .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    startActivity(i);