1
자습서의 샘플에서 XamarinStudio 및 아래 코드베이스를 사용합니다. 여기 질문들.데이터를 두 번째 활동으로 전달할 수없는 이유
- 응용 프로그램을 테스트 할 때 프로젝트 옵션> Android 응용 프로그램에서 AndroidManifest를 생성해야합니까?
심지어 내가 생성 한 AndroidManifest를, 코드를 통해 전달 데이터가없는 이유 :
---Activity 1 [Activity (Label = "HelloMultiScreen", MainLauncher = true,Icon = "@drawable/icon")] public class FirstActivity : Activity { int count = 1; protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); //Use UI created in Main.axml SetContentView (Resource.Layout.Main); var showSecond = FindViewById (Resource.Id.showSecond); showSecond.Click += (sender, e) => { var second = new Intent(this, typeof(SecondActivity)); second.PutExtra("FirstData", "Data from FirstActivity"); StartActivity (typeof(SecondActivity)); }; } } ---Activity 2 [Activity (Label = "SecondActivity")] public class SecondActivity : Activity { protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Create your application here SetContentView (Resource.Layout.Second); var label = FindViewById (Resource.Id.screen2Label); label.Text = Intent.GetStringExtra("FirstData") ?? "Data not available"; } }
감사
당신이 레이블 또는 전혀 아무것도에서 "데이터를 사용할 수 없습니다"를 참조받을 수 있나요 : 는이에 코드를 변경 수정하려면? – jHogen
예. "데이터를 사용할 수 없습니다." – MilkBottle