Ratwanska Ratwanska - 4 months ago 12
Android Question

how show buttons and elements after function loaded in android

It might be silly question but as I am new to android development hope some one will give a right suggestion and I hope wont get down votes for this.

I am having a webview and some textviews and buttons in my android app. First I am showing webview and continue button..

When clicking continue button, I am executing something in onClickListener from activity. In this function I am making visibility view.gone to webview and continue button and setVisibility view.visible to one editText and OK button.

For this editText I am showing value from continue button's onClickListener.

My problem is, editText and OK button are available immediately after clicking continue button. editText value is not available.

I want to stop the view of editText and OK button until value available and then I want to show editText..

How to do this in activity?


What Ankesh advised is right, here bit elaborated as per your need.

Put this code for your "continue" button's onClickListener,

continue.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {               
    AsyncTaskRunner runner = new AsyncTaskRunner();


Also you need to add the following code to get the AsyncTask works..

private class AsyncTaskRunner extends AsyncTask<String, String, String> {
protected String doInBackground(String... params) {
    try {
        // initiate your webview
        // call url in webview          
    } catch (Exception e) {
    return "success";

protected void onPostExecute(String result) {

protected void onPreExecute() {

protected void onProgressUpdate(String... text) {

This should solves your problem.

For more info, take a look in the documentation,https://developer.android.com/reference/android/os/AsyncTask.html