[android-developers] Re: What type is passed as src charsequence/string or other in InputFilter?

2013-01-23 Thread RichardC
CharSequence is an interface not a class and examples of classes that 
implement the CharSequence interface are:

   - String
   - SpannableStringBuilder

See:
http://developer.android.com/reference/java/lang/CharSequence.html
and look at the section *Known Indirect Subclasses*.

On Wednesday, January 23, 2013 2:45:42 PM UTC, SIVAKUMAR.J wrote:

 Dear All,

 Im developing android application.My sdk details are *minimum sdk version 
 is 7 and target and buid sdk version is 10
 *

 In my app in one screen im using *EditText* and im using *filter* for 
 that editText
 the following are my coding snippet

 editText.setFilters
 (
 new InputFilter[] 
 {
 new InputFilter() 
 {
 public CharSequence filter(CharSequence *src*, 
 int start,int end, Spanned dst, int dstart, int dend) 
 {

 String name=src.getClass().getName();
 System.out.println(\n\tSrc class name 
 =+name);

 String tempStr=((String)src).toUpperCase();



 return tempStr;
 }   
 }
 }
 );

 in the above code sometimes *src* be the *String,sometimes it be 
 CharSequence,sometimes it be  android.text.SpannableStringBuilder*
 my doubt is at what scenarios charsequence is passed ,String is passed 
 ,android.text.SpannableStringBuilder is passed as *src*


 -- 
 *Thanks  Regards,
 SIVAKUMAR.J http://stackoverflow.com/users/385138/sivakumar-j
 * 

-- 
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

[android-developers] Re: What type is passed as src charsequence/string or other in InputFilter?

2013-01-23 Thread skink


Siva Kumar wrote:
 my doubt is at what scenarios charsequence is passed ,String is passed
 ,android.text.SpannableStringBuilder is passed as *src*




it depends on CharSequence you used when calling
TextView.setText(CharSequence text)

pskink

-- 
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


[android-developers] Re: What type is passed as src charsequence/string or other in InputFilter?

2013-01-23 Thread Lew
SIVAKUMAR.J wrote:

 Im [sic] developing android [sic] application.My sdk details are *minimum 
 sdk version is 7 and target and buid sdk version is 10
 *

 In my app in one screen im using *EditText* and im using *filter* for 
 that editText
 the following are my coding snippet

 editText.setFilters
 (
 new InputFilter[] 
 {
 new InputFilter() 
 {
 public CharSequence filter(CharSequence *src*, 
 int start,int end, Spanned dst, int dstart, int dend) 
 {

 String name=src.getClass().getName();
 System.out.println(\n\tSrc class name 
 =+name);

 String tempStr=((String)src).toUpperCase();



 return tempStr;
 }   
 }
 }
 );

 in the above code sometimes *src* be the *String,sometimes it be 
 CharSequence,sometimes it be  android.text.SpannableStringBuilder*
 my doubt is at what scenarios charsequence [sic - do not misspell types!] 
 is passed ,String is passed ,android.text.SpannableStringBuilder is passed 
 as *src*
 * http://stackoverflow.com/users/385138/sivakumar-j*


Read the Java Tutorials and study up on polymorphism and subtyping.

This is a very basic Java and object-oriented-programming (OOP) question.

The run-time type of an object is known to itself always. The formal, or 
compile-time type 
is known at compile time (hence the name compile-time type) and is a 
supertype of the 
run-time type.

Anything of the correct type may be passed as a method argument. 

The different scenarios are determined by what is passed into the method 
call.

You really need to study some tutorials. There is a minimum knowledge of 
Java and OOP 
necessary to program for Android.

-- 
Lew

-- 
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