0
我對Android有點新鮮。但是對iOS開發了很多。從活動創建位圖
我有一個父活動(Activity1),它必須在後臺加載並設置另一個活動(Activity2)。然後活性2準備好了,它必須調用,可以採取活性2,並返回一個位圖圖像的方法.. (我需要這個圖像分享至Facebook)
所以我的問題是:
1.How做聲母與顯示出它
2.How時候我的第二個活動,並返回它作爲一個位圖第二活動
public class Activity1 extends Activity implements OnClickListener, KKServerApiListener {
private Activity2 facebookshareActivity;
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_summary);
initView();
/* Try 1 */
facebookshareActivity = new KKFacebookShareActivity(route);
/* Tried with some different things here */
/* Try 2 */
Intent myIntent = new Intent(this, KKFacebookShareActivity.class);
myIntent.putExtra("number", route.id);
this.startActivity(myIntent);
}
public void makeDialogShare(final Context context, final String str) {
/*SETTING UP THE DIALOG */
// ... //
// ... //
dialogButtonOk.setText("Share");
dialogButtonOk.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
/* My try on getting my activity to a bitmap */
View screenView = ****
screenView.setDrawingCacheEnabled(true);
Bitmap bitmap = Bitmap.createBitmap(screenView.getDrawingCache());
screenView.setDrawingCacheEnabled(false);
/* Haven't worked on this part just something i pasted from facebook */
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(bitmap)
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo)
.build();
showDashboard(ctx, true);
//finish();
}
});
final Button dialogButtonCancel = (Button) dialog.findViewById(R.id.btnCancel);
dialogButtonCancel.setText("Continue");
dialogButtonCancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
dialog.dismiss();
//finish();
}
});
dialog.show();
}
}
請問您可以鏈接您迄今爲止嘗試過的'Activity1'代碼嗎? – Tony
所以基本上你想要加載的(因爲它是可見的)Activity2並採取ti的打印屏幕? – leobelizquierdo
活動應該真正向用戶展示可與之互動的內容。如果你想創建一個圖像考慮在你當前的活動中使用畫布或類似物 –