一、調用另外一個apk中assets中的圖片,並轉換成bitmap對象或者drawable對象一、調用另外一個apk中assets中的圖片,並轉換成bitmap對象或者drawable對象java
Context friendContext = MainTabActivity.this.createPackageContext( currentpackagename,//"mblog.theme.test", Context.CONTEXT_IGNORE_SECURITY); InputStream input=friendContext.getAssets().open("test.png"); Bitmap bm=BitmapFactory.decodeStream(input); BitmapDrawable bd= new BitmapDrawable(MainTabActivity.this.getResources(), bm);
二、開啓另外一個apkthis經過PackageManager能夠獲得PackageInfo,經過PackageInfo就能夠獲得你手機上安裝的應用的包名(這個很簡單,網上有的是,不贅述)。關鍵是下一步,代碼以下(也是a應用中Button的onclick中的代碼): code
PackageManager packageManager = Start_RemoveSoftActivity.this.getPackageManager(); Intent intent=new Intent(); try { intent =packageManager.getLaunchIntentForPackage("要調用應用的包名"); } catch (NameNotFoundException e) { Log.i(TAG, e.toString()); } startActivity(intent);
對象