protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.listQRcode_layout); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = "연락처 QR코드";// "QRcodeName"; TextView namev = FindViewById <TextView>(Resource.Id.nameview); TextView numberv = FindViewById <TextView>(Resource.Id.numberview); ImageView qrimageView = FindViewById <ImageView>(Resource.Id.numQRimageview); namev.Text = Intent.GetStringExtra("name"); numberv.Text = Intent.GetStringExtra("number"); SBconverter sBconverter = new SBconverter(); Bitmap numqrcode = sBconverter.stringToBitmap(@"{name:" + namev.Text.ToString() + @",number:" + numberv.Text.ToString() + @"}"); qrimageView.SetImageBitmap(numqrcode); // Create your application here }
//Toolbar toolbar; protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.main); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = "메인";// "QRcodeName"; TextView text = FindViewById <TextView>(Resource.Id.textView2); qrimageView = FindViewById <ImageView>(Resource.Id.qrcodeimage); if (!File.Exists(getNamePath())) { DirectoryInfo directory = new DirectoryInfo(pathpackage = System.IO.Path.Combine(path, PackageName)); if (!directory.Exists) { directory.Create(); } setNameData("Nothing"); } //출처: https://ghj1001020.tistory.com/9 [혁준 블로그] SBconverter sBconverter = new SBconverter(); Bitmap mainqrcode = sBconverter.stringToBitmap(getNamedata(), GetMyPhoneNumber()); qrimageView.SetImageBitmap(mainqrcode); text.Text = getNamedata(); /* * StringBuilder sb = new StringBuilder(@"{number:"); * sb.Append(GetMyPhoneNumber()); */ /* * StreamWriter textWrite = File.CreateText(folder+@"/test.txt"); //생성 * textWrite.WriteLine("abcdefghijk"); //쓰기 * textWrite.Dispose(); //파일 닫기 */ }
public void okclick(View view) { setNameData(editText.Text); TextView text = FindViewById <TextView>(Resource.Id.textView1); text.Text = editText.Text; SBconverter sBconverter = new SBconverter(); Android.Graphics.Bitmap mainqrcode = sBconverter.stringToBitmap(@"{name:" + editText.Text + @",number:" + mainact.GetMyPhoneNumber() + @"}"); ImageView qrimageView = FindViewById <ImageView>(Resource.Id.qrcodeimage); qrimageView.SetImageBitmap(mainqrcode); }
public void insertNameClick(Android.Views.View view) { TextView text = FindViewById <TextView>(Resource.Id.textView2); EditText editText = FindViewById <EditText>(Resource.Id.editNameText); setNameData(editText.Text); text.Text = editText.Text; SBconverter sBconverter = new SBconverter(); Bitmap mainqrcode = sBconverter.stringToBitmap(editText.Text, GetMyPhoneNumber()); qrimageView = FindViewById <ImageView>(Resource.Id.qrcodeimage); qrimageView.SetImageBitmap(mainqrcode); }