Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>you could make your method createBigWindow return the range object it just created</p> <pre><code>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; } </code></pre> <p>and then in your Out_of_range class create a method to receive the String you want to pass.</p> <p>Edit: </p> <pre><code>//in your Out_of_range class public void receiveStringValue(String value) { // do whatever you want } </code></pre> <p>and use it from your Main class after using the createBigWindow method:</p> <pre><code>Out_of_range range = MyWindowManager.createBigWindow(this); range.receiveStringValue(yourString); </code></pre> <p>I didn't try this out but I think it's worth trying.</p> <p>Edit2: </p> <p>Now that you've updated your Question it's clearer: try this:</p> <pre><code>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); } }); } </code></pre> <p>And in your main, do something like this:</p> <pre><code>MyWindowManager.createBigWindow(getApplicationContext(), "your value here"); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload