level 1
末路阿菠萝
楼主
现在是实现了,但现在如果我改变这三个button的顺序

,例如把拨号与百度调换位置,变成

,则拨号实现的是原来百度的功能,即相同的位置相同的功能。
下面是button功能的实现;
Button button1=(Button) findViewById(R.id.button_1);
button1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO 自动生成的方法
//Toast.makeText(FirstActivity.this, "点我干嘛", Toast.LENGTH_SHORT).show();
Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.baidu.com"));
startActivity(intent);
}
});
Button button2=(Button) findViewById(R.id.button_2);
button2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO 自动生成的方法
//Toast.makeText(FirstActivity.this, "点我干嘛", Toast.LENGTH_SHORT).show();
Intent intent=new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:10086"));
startActivity(intent);
}
});
Button button3=(Button) findViewById(R.id.button_3);
button3.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO 自动生成的方法
Toast.makeText(FirstActivity.this, "点我干嘛", Toast.LENGTH_SHORT).show();
/*Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.baidu.com"));
startActivity(intent);*/
}
});
2015年07月27日 05点07分
1

,例如把拨号与百度调换位置,变成
,则拨号实现的是原来百度的功能,即相同的位置相同的功能。下面是button功能的实现;
Button button1=(Button) findViewById(R.id.button_1);
button1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO 自动生成的方法
//Toast.makeText(FirstActivity.this, "点我干嘛", Toast.LENGTH_SHORT).show();
Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.baidu.com"));
startActivity(intent);
}
});
Button button2=(Button) findViewById(R.id.button_2);
button2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO 自动生成的方法
//Toast.makeText(FirstActivity.this, "点我干嘛", Toast.LENGTH_SHORT).show();
Intent intent=new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:10086"));
startActivity(intent);
}
});
Button button3=(Button) findViewById(R.id.button_3);
button3.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO 自动生成的方法
Toast.makeText(FirstActivity.this, "点我干嘛", Toast.LENGTH_SHORT).show();
/*Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.baidu.com"));
startActivity(intent);*/
}
});