I am trying to set up and use a focus change listener for an Edittext
view. I have included "OnFocusChangeListener" after "implements" in
my beginning class statement.
public class todolist extends Activity implements
OnItemSelectedListener, OnTouchListener,
OnFocusChangeListener {
This necessitates the inclusion of the following methods
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onFocusChanged(ItemizedOverlay overlay, OverlayItem
newFocus) {
// TODO Auto-generated method stub
}
When I try to run the app with these additions it crashes. Help
Please
I don't understand the ItemizedOverlay and the OverlayItem or what to
do with them.I was expecting something like
public abstract void onFocusChange (View v, boolean hasFocus)
I have included this in my onCreate method
EditText et = (EditText)findViewById(R.id.myedittext);
et.getOnFocusChangeListener();
I wanted to make it setOnFocusListener() but it didn't like it and
suggested the change.
then I added setOnFocusListener() on the next line after the
getOnFocusChangeListener();
but I can,t get past the first step above
I was going to make use of this (simplified version) as follows
public void onFocusChange (View v, boolean hasFocus) {
TextView tv =
(TextView)findViewById(R.id.count_total);
EditText et = (EditText)findViewById(R.id.myedittext);
tv.setText(et.getText())
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---