0

I have question about using wysiwyg gui editor in android SDK.
I have simple activity and one control (e.g. radio). I want to use non-default names for handlers, so I have to set parameter in every control like android:onClick="klocek" in xml or just "On Click" in wysiwyg parameters.
Is there any option to automatically generate those functions? I mean I write name of my handler and eclipse will generate this function in my java code?
In visual studio for c# there is ability to make something like this but what about android eclipse?

cybek
  • 1
  • aleś Ty leniwy :)... actually there is no connection between layout and java code ... so now is the question how on hell IDE will know where do you wana use this layout ? – Selvin Jul 29 '14 at 13:33
  • To nie leniwość, to kwestia tego, że różne funkcje mogą pobierać różne argumenty. A wchodzenie do dokumentacji po to, jest dość uciążliwe. – cybek Jul 29 '14 at 13:35
  • Eclipse automatically generate xml and java files, so I thought that it will know in which file it should add my functions. Anyway, is there any fast way to check which arguments function need have? Different from searching appropriate "set***Listener" arguments? – cybek Jul 29 '14 at 13:36
  • only onClick is supported in xml layout(and AFAIK only if it is Activity layout) – Selvin Jul 29 '14 at 13:41
  • Oh... You're right, I hoped that every listener can be made that way. Thanks! – cybek Jul 29 '14 at 13:52

1 Answers1

0

No you can't change this , or you can do it manually in XML that is generated by default

  • I know how to change name of specific handler, but I'm searching for fast way to check what arguments need my handler. I mean, eg. OnClickListener have only "View" argument, but other handlers have other arguments. If I want to write my handler function, is there any other way to check what arguments my function should have, instead of looking to corresponding set***Listener method? – cybek Jul 29 '14 at 13:43
  • aha, I understand you now :) .Well it is not easy , especially if you don't have experience with Reflection :D I worked reflection a lot, and it is such a pain sometimes.Generally you will need to use reflection, get methods, and get method definitions , and then you can call the method or do what you want http://stackoverflow.com/questions/160970/how-do-i-invoke-a-java-method-when-given-the-method-name-as-a-string http://docs.oracle.com/javase/tutorial/reflect/member/methodInvocation.html – Stanojevic Dalibor Jul 30 '14 at 09:37