2016-08-03 15 views
1

私はprogressBarと2つのtextViewで構成されるDownloadInfoというクラスを持っていますが、インテントで送信して相手側でオブジェクトを維持するにはどうすればいいですか?インテントを介してオブジェクトを送信する方法

+0

は、なぜあなたはJavaオブジェクト(別名POJO)内のビューを置くでしょうか? – Sufian

+1

意図はいくつかの特定の操作のためのものです、このhttp://www.tutorialspoint.com/android/android_intents_filters.htm – Stallion

+0

あなたはあなたの意図でパーセル可能なオブジェクトまたはクラスを送ることができます –

答えて

1

Serializable~DownloadInfoクラスを実装します。他の側では

Intent intent = new Intent(Youractivity.this, OtherActivity.class); 
Bundle args = new Bundle(); 
args.putSerializable("downloadInfo", DownloadInfo object); 
intent.putExtras(args); 

if (getIntent().hasExtra("downloadInfo")) 
    downloadInfo = (DownloadInfo) getIntent().getExtras().getSerializable("downloadInfo"); 
+0

親愛なる@faranjitあなたのコードを使用すると、私のdownloadInfoオブジェクトは画像とprogressBarとtextで構成されています.NotSerializableException:android.widget.ImageView、どうすれば解決できますか? – DavidOli

+0

あなたがやりたいことといくつかのコードについてもっと詳しく教えてください。 – faranjit

関連する問題