六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 670|回复: 0

mono_for_android读书笔记之真机调试

[复制链接]

升级  80%

10

主题

10

主题

10

主题

童生

Rank: 1

积分
40
 楼主| 发表于 2013-1-4 01:20:28 | 显示全部楼层 |阅读模式
<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{    [Activity(Label = "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 函数内下断点。手机上开始运行应用,点击按钮,程序会断在断点处,如下图所示。

您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表