如何在android app开发中的另一个java文件中访问或执行.java文件?

时间:2010-05-19 15:34:40

标签: android

我有2个java文件app.java和gallaery.java

App.java public class App extends Activity实现OnClickListener {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);


    Button Listvideo = (Button) findViewById(R.id.Listvideo);
    Listvideo.setOnClickListener(this); 

public void onClick(查看视图){

if(view == findViewById(R.id.Listvideo)){

   // i have to call gallery.java here which executes list of images in the android pone 

  }

}

1 个答案:

答案 0 :(得分:0)

假设Gallery.java还扩展了Activity,你应该调用:

Intent mIntent = new Intent(this, Gallery.class);
startActivity(mIntent);