Different use of this operator in android -
i want know different use of operator in android. have seen example, confused like:
intent intent=new intent(main activity.this, second activity.class) here "this" refer to?
handler handler= new handler(); thread t1; t1=new thread(new runnable)){ void run(){ handler.postdelayed(this,2000); } } here, "this" refer to?
i know "this" refer current instance of class, here instance passing thread class or other , more example know regarding keyword. please tell me.
i beginner android. great me regarding clearing concepts.
the intent function using has take context , class parameters,
intent(context packagecontext, class<?> cls) hence this here context. in general, want use current class working on context parameter function, use this. read more intent constructor here
in second block of code, this refers runnable class want function run on.
i suggest google function or constructor traceback parameters.
Comments
Post a Comment