you could make your method createBigWindow return the range object it just created
public static Out_of_range createBigWindow(Context context) {
WindowManager windowManager = getWindowManager(context);
int screenWidth = windowManager.getDefaultDisplay().getWidth();
int screenHeight = windowManager.getDefaultDisplay().getHeight();
if(bigWindow == null) {
bigWindow = new Out_of_range(context);
if(bigWindowParams == null) {
bigWindowParams = new LayoutParams();
bigWindowParams.x = screenWidth / 2 - Out_of_range.viewWidth / 2;
bigWindowParams.y = screenHeight / 2 - Out_of_range.viewHeight / 2;
bigWindowParams.type = LayoutParams.TYPE_PHONE;
bigWindowParams.format = PixelFormat.RGBA_8888;
bigWindowParams.gravity = Gravity.LEFT | Gravity.TOP;
bigWindowParams.width = Out_of_range.viewWidth;
bigWindowParams.height = Out_of_range.viewHeight;
}
windowManager.addView(bigWindow, bigWindowParams);
}
return bigWindow;
}
and then in your Out_of_range class create a method to receive the String you want to pass.
Edit:
//in your Out_of_range class
public void receiveStringValue(String value) {
// do whatever you want
}
and use it from your Main class after using the createBigWindow method:
Out_of_range range = MyWindowManager.createBigWindow(this);
range.receiveStringValue(yourString);
I didn't try this out but I think it's worth trying.
Edit2:
Now that you've updated your Question it's clearer: try this:
public class Out_of_range extends LinearLayout {
public static int viewWidth;
public static int viewHeight;
public Out_of_range(final Context context, String value) {
super(context);
// TODO Auto-generated constructor stub
LayoutInflater.from(context).inflate(R.layout.out_of_range, this);
View view = findViewById(R.id.big_window_layout);
viewWidth = view.getLayoutParams().width;
viewHeight = view.getLayoutParams().height;
device = (TextView) findViewById(R.id.device);
device.setText("device = " + value);
Button back = (Button)findViewById(R.id.back);
back.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
MyWindowManager.removeBigWindow(context);
}
});
}
And in your main, do something like this:
MyWindowManager.createBigWindow(getApplicationContext(), "your value here");