The question is that you can see that I cannot set the edittext value dynamically before showDialog ().
import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.telephony.TelephonyManager; import android.view.LayoutInflater; import android.view.View; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends Activity { private static final int DIALOG_TEXT_ENTRY = 7; private int user_id; private int dialogChoice; private String mobileNum; private EditText input2 ; private EditText input1 ; public TextView textView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.alert_dialog_text_entry); TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); mobileNum =tm.getLine1Number();
}
textView.setText("hello"); this line kills the app.
early.
akd
source share