njuxdj 发表于 2013-1-4 01:20:28

mono_for_android读书笔记之真机调试

<div id="cnblogs_post_body">调试环境:
1.软件:monodevelop v3.0.3.5
2.硬件:华为C8650s手机一部,数据线一根,thinkpad e420笔记本电脑一台
调试的应用程序有一个Activity,Activity上有一个按钮,按钮的caption会记录按钮的点击次数。
测试程序如下:
using System; using Android.App;using Android.Content;using Android.Runtime;using Android.Views;using Android.Widget;using Android.OS; namespace AndroidApplication2{    AndroidApplication2", MainLauncher = true, Icon = "@drawable/icon")]    public class Activity1 : Activity    {      int count = 1;         protected override void OnCreate(Bundle bundle)      {            base.OnCreate(bundle);             // Set our view from the "main" layout resource            SetContentView(Resource.Layout.Main);             // Get our button from the layout resource,            // and attach an event to it            Button button = FindViewById<Button>(Resource.Id.MyButton);            button.Click += HandleClick;      }         void HandleClick (object sender, EventArgs e)      {            Button button = FindViewById<Button>(Resource.Id.MyButton);            button.Text = string.Format("{0} clicks!", count++);      }    }}
在monodevelop上编译:build->build all.
连上手机,开始调试:运行->Start Debugging->选择device->点击OK
等待程序下载到手机后,在程序中HandleClick 函数内下断点。手机上开始运行应用,点击按钮,程序会断在断点处,如下图所示。
http://images.cnblogs.com/cnblogs_com/njuxdj/201212/201212202215312583.jpg
http://images.cnblogs.com/cnblogs_com/njuxdj/201212/20121220221642769.jpg
页: [1]
查看完整版本: mono_for_android读书笔记之真机调试