This is a 2 part question. Firstable, I have this EditText
which is strictly set that user can put numbers only by android:inputType="number"
. Like:
<EditText
android:id="@+id/edit_A1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:imeOptions="actionDone"
android:inputType="number"
android:hint="@string/zeroes" />
<TextView
android:id="@+id/act1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/act_string"
android:layout_centerVertical="true"
android:hint="000," />
What kind of output do I get from it? Is it normal String
or Integer
?
Secondly, I would like to set the TextView
(code above) this way that when I input the number to the EditText
and hit OK
button from the appeared numpad, the number will immediately appear in the TextView
. Both EditText
and TextView
are in the same activity. I have the following code:
public static class MainSectionFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.main, container, false);
EditText mAcu1ET = (EditText) rootView.findViewById(R.id.edit_A1);
TextView mAcu1TV = (TextView) rootView.findViewById(R.id.act1);
//????
return rootView;
}
}
to create the view. What kind of onClickListener
should I implement so my TextView
would change its value on OK
button click from the EditText
numpad? Still learning, go easy on me.
Title of the topic might be confusing, sorry!