My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 96: Feature request: double-click a widget to produce onClickListener() code
1 person starred this issue and may be notified of changes. Back to list
Status:  Accepted
Owner:  ----
Type-Enhancement
Priority-Medium


Sign in to add a comment
 
Reported by ToneDef1, Mar 05, 2009
(This should be an Enhancement, not an Issue.)


DroidDraw is a fantastic time-saving tool! What I would really like to see
(if you have the time and donation money to motivate you! :) is a feature
where you double-click a widget and the onClickListener() code is
automatically generated for you.

The code could go into a separate text box so it could be easily copied and
pasted into your .java file. This would only apply to widgets that have
onClickListener() implemented, of course.

You could use the widget's id to generate the name of the corresponding
Java object, and also to create the method that onClick() uses. For example:

If you had the following ImageButton:


<ImageButton
    android:id="@+id/butSaveSettings"
    android:layout_width="100dip"
    android:layout_height="wrap_content"
    android:src="@drawable/save_button" />


Then when you double-click it this code would be automatically generated:


final ImageButton butSaveSettings = (ImageButton)
findViewById(R.id.butSaveSettings);
butSaveSettings.setOnClickListener(new OnClickListener() {
    public void onClick(View v) { butSaveSettings_Click(); }
});

private void butSaveSettings_Click()
{
    // CODE FOR USER CLICKING butSaveSettings GOES HERE...
}


Yes, I come from a Visual Studio development background where this feature
is standard... but it comes in very handy!!

Keep up the great work Brendan!
Comment 1 by brendan.d.burns, Mar 08, 2009
This is very much the direction that I would like to take DroidDraw.  There is *very*
rudimentary support for this in SVN, I will be moving this forward (slowly) over the
next few months.
Status: Accepted
Comment 2 by brendan.d.burns, Mar 08, 2009
(No comment was entered for this change.)
Labels: -Type-Defect Type-Enhancement
Sign in to add a comment

Hosted by Google Code