Runnable with a parameter?

I have a need for a “Runnable that accepts a parameter” although I know that such runnable doesn’t really exist.

This may point to fundamental flaw in the design of my app and/or a mental block in my tired brain, so I am hoping to find here some advice on how to accomplish something like the following, without violating fundamental OO principles:

  private Runnable mOneShotTask = new Runnable(String str) {
    public void run(String str) {
       someFunc(str);
    }
  };  

Any idea how to accomplish something like the above?

9 Answers
9

Leave a Comment