this code
...
private LayoutInflater layoutInflater;
private ViewGroup rootView;
int wrap_content = WindowManager.LayoutParams.WRAP_CONTENT;
...
linearLayoutPopup = new LinearLayout(this);
linearLayoutPopup.setBackgroundColor(getResources().getColor(R.color.colorExResult));
linearLayoutPopup.setOrientation(LinearLayout.HORIZONTAL);
layoutInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
mParams = new WindowManager.LayoutParams(
wrap_content,
wrap_content,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
mParams.gravity = Gravity.LEFT | Gravity.TOP;
mParams.y = 100;
rootView = (ViewGroup) layoutInflater.inflate(R.layout.service_bike_value, null);
linearLayoutPopup = (LinearLayout) layoutInflater.inflate(R.layout.service_bike_value, null);
if(rootView != null) {
textView_speed_service = (TextView) rootView.findViewById(R.id.textView_Speed_service);
}
timerHandler.sendEmptyMessage(0);
...
public Handler timerHandler = new Handler(){
public void handleMessage(Message msg)
{
textViewspeed.setText(""+speed);
Log.d("textViewSpeed", textViewspeed.getText().toString());
timerHandler.sendEmptyMessageDelayed(0, 200); }
};
I created a view in my code without referencing the previously created Layout and it worked when I setText
. However, setText
does not work properly after you reference the layout. Strangely, getText().toString()
in Log is properly written to Log. I do not know where it is wrong.
Is there anything I have done wrong?
and anything missed?
Please tell me. Thank you.