fasdgoc fasdgoc - 1 year ago 70
Android Question

How do i optimize android application?

I am making a android application not using complicated task but using ui controlling.
But, i saw the log of the android monitor of android studio.
It says something '41 frames below, warning blah blah...'

I want to extract the code from main thread(ui thread) to another thread...
but, the code i wrote was just used ui controll(like

AlertDialog.Builder dialog.... show()
Button button = (Button)findViewById(R.id....)

My one activity code line is >300 lines. I think it is too big... So I want separate code diffused, so is this the reason ? (low performance)
I think i use a thread maybe

so i thought
.. but
I read the guide, and
is just sending the runnable.
of course, the runnable sent is executed by main thread(ui thread).
so there is not reason to use
? why people use this ?

Answer Source

why people use this ?

it is used when lets assume you have a background task running and you want to update the layout then you call runonuithread method, since we can only update the layout on Main thread so we use this method.

That is only one use I told to explain a little

Hope it helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download