0

I have a project to make two button. One button to open FileChooser, and another one to generate MD5 hash.

I have created the layout. I'm also already has the needed class, FileChooser.java and md5.java. But i'm still confused how to call them with OnClickListener.

findViewById(R.id.button1).setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {

        // Action

    }
});

I don't know what to write in that "Action" line to calling that both class.

dimakura
  • 7,575
  • 17
  • 36

2 Answers2

0

You can do one thing is that whatever method you required from md5.java or FileChooser.java , make that method static and then writing below code:

findViewById(R.id.button1).setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {

      FileChooser.yourmethodname();

    }
});
KishuDroid
  • 5,411
  • 4
  • 30
  • 47
0

Usually you can employ a new action by starting a new intent

See this link for more information about chooser: http://code.tutsplus.com/tutorials/android-sdk-implement-a-share-intent--mobile-8433

See this link for example how intent is being deployed in a listener: open a url on click of ok button in android

Community
  • 1
  • 1
sivi
  • 10,654
  • 2
  • 52
  • 51