[Solved] edittext.getText().getString() is always empty [closed]

Android edittext.getText().toString() is always empty.. Because you assigning it as empty. public String Setphase2(Button r,Button l,TextView t,EditText i) { i.setText(“”); // See this line************** r.setText(R.string.upload); l.setText(R.string.edit); t.setText(R.string.key_task); String inputText = i.getText().toString(); Log.d(“UserText”, “Entry text is:” + inputText); i.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); return inputText; } Remove the following line in the above method. i.setText(“”); 1 solved edittext.getText().getString() is always … Read more

[Solved] java.lang.NullPointerException while fetching value from EditText [duplicate]

You can’t just instantiate your Activity and access the TextView members on it. This doesn’t make any sense: indoor_patient ins=new indoor_patient(); String webUrl = “http://10.0.3.2:8084/data_web/indoorPatient.jsp?sr_no=” + ins.sr_no.getText().toString() Instead you could figure out what your webUrl is in your onClick() method and pass in the complete URL as a parameter to the AsyncTask: submit.setOnClickListener(new View.OnClickListener() { … Read more

[Solved] What happens when EditText has a null? [closed]

If the EditText has no contents, it will return a blank string, or a “” In order to return with 0, simply set up an if statement: EditText editText = (EditText) mParent.findViewById(Rid_something); String string = editText.getText().toString().trim(); if (string.equals(“”)) { return “0”; } else { return string; } This will return 0 if blank, or the … Read more

[Solved] Change EditText with Button click

In your MainActivity.java: public void onClicknews(View v) { String titel1 = “Trumps brutales Kalkül”; EditText article = (EditText) findViewById(R.id.articlename); String s = article.getText().toString(); Intent intent = new Intent(getApplicationContext(), NewsActivity.class); intent.putExtra(“articalName”,s); startActivity(intent); } In your NewsActivity.java: EditText news = (EditText) findViewById(R.id.news); String newsName = getIntent().getStringExtra(“articalName”); news.setText(newsName ); 0 solved Change EditText with Button click

[Solved] Why edit text is underlined?

EditText is disabled Use a TextView instead. how can I remove underline? Use a TextView instead. Or, use a different background for the EditText, probably. I assume that the Theme.Material/Theme.AppCompat way of supplying that bracket is via the background, as it was with Theme and Theme.Holo. I have not changed the background of an EditText … Read more

[Solved] Calculating percentages value of edittext in android

Suppose service_tax_et and penalty_et are new editTexts, don’t add them to the array instead set focusChangeListener on them manually and then try like this: private View.OnFocusChangeListener mFocusChangeListener = new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { float total = 0; for (int i=0 ; i<editTexts.length-1 ; i++) { try { total += … Read more

[Solved] Getting values of edit text error NULLPOINTER why? [closed]

Try instead EditText edt1=(EditText)dialog.findViewById(R.id.EditTextNom); you need to look in the layout that is inflated for the Dialog. Right now it is looking in the one that was inflated for the Activity and, obviously, those Views don’t exist in that layout. 1 solved Getting values of edit text error NULLPOINTER why? [closed]

[Solved] Getting a value of int from edittext

I think when you run your program then edit text have no value that means it will return NULL and NULL can’t be a Integer value so you must have to check Condition Like String editTextValue = number.getText().toString(); if(!TextUtils.isEmpty(editTextValue)){ angka = Integer.parseInt(editTextValue); } I hope its work for you. 3 solved Getting a value of … Read more

[Solved] Get integer value from edittext And Access value on Button

Declare the ed_text and mViewPager in your onCreate like this final EditText ed_text =(EditText)findViewById(R.id.editText1); final ExtendedViewPager mViewPager = (ExtendedViewPager) findViewById(R.id.view_pager); and now you can access the ed_text value in the bt_Goto click listener like this bt_Goto.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(ed_text.getText().toString().length() > 0){ mViewPager.setCurrentItem(Integer.parseInt( ed_text.getText().toString())); } } }); 1 solved Get … Read more

[Solved] I am using editText for password field in android. How to show the password visible for few seconds and then mask it with asterisk symbol?

more simple way use TextInputLayout compile design library to your dependecies compile “com.android.support:design:26.0.+” TextInputLayout Layout which wraps an EditText (or descendant) to show a floating label when the hint is hidden due to the user inputting text. <android.support.design.widget.TextInputLayout xmlns:app=”http://schemas.android.com/apk/res-auto” android:layout_width=”match_parent” android:layout_height=”wrap_content” app:passwordToggleEnabled=”true”> <android.support.design.widget.TextInputEditText android:layout_width=”match_parent” android:layout_height=”wrap_content” android:hint=”Enter EMail Address” android:inputType=”textPassword”/> </android.support.design.widget.TextInputLayout> 0 solved I am using … Read more

[Solved] how to get value in edittext in an actvity from second activity?

Try this. Use below code for pass value from first activity to second activity. Intent mInSecond = new Intent(FirstActivity.this, SecondActivity.class); mInSecond.putExtra(“Value”, mEdttxtpassword.getText().toString()); startActivity(mInSecond); Use below code for get value Bundle bdl = getIntent().getExtras(); String mValue = bdl.getString(“Value”); solved how to get value in edittext in an actvity from second activity?