主要活动layoutInflater,活动不启动

时间:2013-02-05 19:33:24

标签: android layout main layout-inflater

当我点击plbutton1时,我不接受结果。
当我点击plbutton2时,活动R.layout.paraggeleia打开corect 任何人都可以帮助我吗? 哪里弄错了?  这是我的代码!!!!

    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {

        Bundle args = getArguments();
        switch (args.getInt(ARG_SECTION_NUMBER)){

        case 1: 
            View v = inflater.inflate(R.layout.paraggeleia, container, false);
            Button bTutorial = (Button) v.findViewById(R.id.plbutton2);
            bTutorial.setOnClickListener(new View.OnClickListener(){
                 public void onClick(View v){
                  getActivity().startActivity(new Intent (getActivity(), parageleiaproionta.class));

                  Toast.makeText(v.getContext(), "Loaging Προιόντα", Toast.LENGTH_SHORT).show();

                 }
             });
     return v;

        case 2:
            View m =  inflater.inflate(R.layout.paraggeleia, container, false);

             Button b1Tutorial = (Button) m.findViewById(R.id.plbutton1);
            b1Tutorial.setOnClickListener(new View.OnClickListener(){
                  public void onClick(View m){
                   getActivity().startActivity(new Intent (getActivity(), sxetika.class));

                   Toast.makeText(m.getContext(), "Loaging Προιόντα", Toast.LENGTH_SHORT).show();

                  }
              });
      return m;

    }

        return getView();

}


    }

1 个答案:

答案 0 :(得分:0)

可能是因为您有切换,只会处理第二个语句。