例如:第一次:我放了18001090,我收到了:180010090
第二次:我输入056113,但收到:180010090
我多放了
Intent notificationIntent = new Intent(context, typeof(MainActivity));
notificationIntent.SetAction("android.intent.action.MAIN");
notificationIntent.PutExtra("number", incomingNumber);
在MainActivity上
var number = this.Intent.GetStringExtra("number");
答案 0 :(得分:0)
我使用Intent来添加多余的东西,但是我却没有得到结果,这是我的代码。
我在layout5上添加EditText和Button,在layout6上添加TextView。
主要活动:
private EditText edittext;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.layout5);
btn1 = FindViewById<Button>(Resource.Id.button1);
edittext = FindViewById<EditText>(Resource.Id.edittext1);
btn1.Click += Btn1_Click1;
}
private void Btn1_Click1(object sender, EventArgs e)
{
Intent i = new Intent(this, typeof(Activity1));
//Add PutExtra method data to intent.
i.PutExtra("Name", edittext.Text.ToString());
//StartActivity
StartActivity(i);
}
主动性1:
private TextView text;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.layout6);
// Create your application here
string name = Intent.GetStringExtra("Name");
text = FindViewById<TextView>(Resource.Id.textview1);
text.Text = name;
Log.Debug("123" ,name);
}