var intent = new Intent(this, typeof(Activity1)); StartActivity(intent);
var call = new Intent(Intent.ActionCall); //初始化一个电话呼叫
call.SetData(Android.Net.Uri.Parse("tel:13811112222"));
StartActivity(call);
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Button android:id="@+id/btn1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="打电话" /> <Button android:id="@+id/btn2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="转到活动1" /> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:text="这是活动1的界面\n\n提示:按【Back】按钮返回" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textView1" android:layout_gravity="center" android:layout_margin="30dp" /> </LinearLayout>
using Android.App;
using Android.Content;
using Android.OS;
using Android.Widget;
namespace MyDemos.SrcDemos
{
[Activity(Label = "【例12-1】Intent基本用法1")]
public class ch1201IntentDemoMain : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.ch1201_Main);
//启动电话拨号的Activity
FindViewById<Button>(Resource.Id.btn1).Click += delegate
{
var call = new Intent(Intent.ActionCall);
call.SetData(Android.Net.Uri.Parse("tel:13811112222"));
StartActivity(call);
};
//启动自定义的Activity
FindViewById<Button>(Resource.Id.btn2).Click += delegate
{
var intent = new Intent(this, typeof(ch1201IntentDemoActivity1));
StartActivity(intent);
};
}
}
}
using Android.App;
using Android.OS;
namespace MyDemos.SrcDemos
{
[Activity(Label = "【例12-1】Intent基本用法1")]
public class ch1201IntentDemoActivity1 : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.ch1201_Layout1);
}
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有