小部件中的两个按钮

时间:2013-09-20 09:29:33

标签: android widget

有人可以告诉我如何点击窗口小部件的一个按钮并更改视图然后再转到其他活动吗?

提前致谢。

1 个答案:

答案 0 :(得分:0)

   First take the id of both button and store it in Btn1 and Btn2 respective id and do this
 Btn1.setOnClickListener(new OnClickListener()
            {

                public void onClick(View v){
    FrameLayout userwallFrmWall = (FrameLayout) findViewById(R.id.floatinglist_frm_startpage);
            viewMyWall = getLayoutInflater().inflate(R.layout.mywall, null);
            userwallFrmWall.addView(viewMyWall);



    });
    Btn1.setOnClickListener(new OnClickListener()
            {

                public void onClick(View v){
    Intent intent=new Intent(this,desired.class);
    startActivity(intent);
    });
相关问题