Hi, thanks for your answer. i try option 1 today, but i couldnt call the funtion in my MainActivity class:
My steps: in MainActivity: xmlHandler = new XMLHandler ( MainActivity.this ); // <-- is that the Activity, i think so ?? in XMLHandler (normal java file): Activity main; public XMLHandler (Activity act) { this.main = act; } I now want to call the specific function, but i can't say: act.callMethodOfMainActivity (aValue); I also try to pass the Context, but first i dont think, that this is the activity and secondly, the same error occur. Thanks, Stefan PS: Is it also possilbe to use the Singleton Pattern? But the easier way and also my favorite is option 1. On Oct 30, 1:13 pm, Mark Murphy <mmur...@commonsware.com> wrote: > Stefan wrote: > > i have following problem: > > I have my "MainActivity". In this Activity, i start a thread > > (SaxParser in another "normal" java file). Now I want to call a method > > from the MainActivity out of the normal java file? > > Option #1: Pass the Activity in the constructor of your object from your > "normal java file" > > Option #2: Have the Activity call a setter on your object from your > "normal java file" (e.g., setActivity(this);) > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Android Development Wiki:http://wiki.andmob.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---