android 如何实现button 的自动点击 定义了一个button 如何打开应用程序之后 button自动点击

Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
// Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);// 调用相机
// startActivityForResult(intent, 1);
startCamera();
}

});

// 声明LocationManager对象

}

private void startCamera()
{
Intent i = new Intent(this, CameraBackGroudActivity.class);
startActivityForResult(i, 10);
}

这个是实现不了的。你只能在activity刚加载的时候进行点击button的操作。你也可以不加上button的。你的这个需求加不加button都没有多少区别了。追问

请问怎么在activity加载时进行点击button 的操作? 具体代码能说一下吗 谢谢

温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-12-08
button.performClick();

追问

能详细说一点吗? 具体能给下代码的详细注释吗

追答

button.perform就是调用了button的点击方法。

第2个回答  2014-12-09
就点一下?还是有什么额外操作什么的?思维放简单啊,把startCamera()方法在oncreate()里调用一次不就解决了。
Java桌面应用程序设计:SWT简介
private void initShell(Shell shell) { \/\/为Shell设置布局对象 GridLayout gShellLay = new GridLayout(); shell setLayout(gShellLay); \/\/构造一个Composite构件作为文本框和按键的容器 Composite panel = new Composite(shell SWT NONE); \/\/为

FLASH的按钮怎么运用呀
1 在「文档」窗口的「设计」视图中,从「对象」面板选取「插入Flash按钮」或者选择「插入>交互式图象>Flash按钮」。您也可以将Flash按钮图标拖动到「文档」窗口中。「插入Flash按钮」对话框出现。2 从「样式」列表中选取您需要的按钮样式。您将在「范例」域中看到按钮的一个示例,您可以点击该范例以查...

相似回答