Here is my code:
public class MainActivity extends AppCompatActivity {
Runnable runnable;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
runnable=new Runnable() {
@Override
public void run() {
Log.i("hello","runnable") ;
}
};
}
}
Why is it not printing log? Do I need a handler and then pass runnable object in it? Does run()
method runs only once?