[Android Apps and Games] brandall:
Something's gone wrong.....

Hey pingpongboss, hope you're cool

Something's gone wrong.......

I've done a search on the thread and read back through the last few pages, but no-one else seems to be having my issue. Firstly, I changed absolutely nothing...... Other than compiling and targeting my app against 4.3.

The window is starting to display nothing most of the time - Then when it does display something, if I resize it, the content disappears.... I'm also getting some errors when I scroll up and down. Don't know why it's suddenly broken?!

Here's the really basic code I'm using:

[MENTION=439709]override[/MENTION]
public void createAndAttachView(int id, FrameLayout frame) {
if (DE.BUG) {
MyLog.i("createAndAttachView");
}

LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);

switch (id) {

case StandOutWindow.DEFAULT_ID:

View vrw = inflater.inflate(R.layout.voice_results_widget, frame, true);

wordsList = (ListView) vrw.findViewById(R.id.listWindow);

ArrayList<String> toDisplay = new ArrayList<String>();

toDisplay = GlobalV.getArrayData();
if (DE.BUG) {
MyLog.i("toDisplay: " + toDisplay.toString());
}

wordsList
.setAdapter(new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, toDisplay));

break;

My custom logging class confirms that there is data in the ArrayList, but it doesn't show 70% of the time - The floating window appears empty?

Here's the very basic XML layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#aa000000"
android:orientation="vertical" >

<ListView
android:id="@+id/listWindow"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" />

</LinearLayout>

And finally here is the stack trace that's being generated when I try to scroll/tap on results (when they are being displayed):

08-24 00:11:14.075: E/AndroidRuntime(7275): FATAL EXCEPTION: main
08-24 00:11:14.075: E/AndroidRuntime(7275): java.lang.IndexOutOfBoundsException: Invalid index 3, size is 0
08-24 00:11:14.075: E/AndroidRuntime(7275):	at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at java.util.ArrayList.get(ArrayList.java:304)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.widget.ArrayAdapter.getItem(ArrayAdapter.java:337)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:390)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.widget.AbsListView.obtainView(AbsListView.java:2461)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.widget.ListView.makeAndAddView(ListView.java:1775)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.widget.ListView.fillDown(ListView.java:678)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.widget.ListView.fillGap(ListView.java:642)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5525)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.widget.AbsListView.scrollIfNeeded(AbsListView.java:3413)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.widget.AbsListView.onTouchEvent(AbsListView.java:3901)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.View.dispatchTouchEvent(View.java:7337)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2410)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2145)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2416)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.View.dispatchPointerEvent(View.java:7520)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3376)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3308)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4402)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4380)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4484)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:163)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4452)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4503)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.Choreographer.doCallbacks(Choreographer.java:555)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.Choreographer.doFrame(Choreographer.java:523)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.os.Handler.handleCallback(Handler.java:615)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.os.Handler.dispatchMessage(Handler.java:92)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.os.Looper.loop(Looper.java:137)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at android.app.ActivityThread.main(ActivityThread.java:4898)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at java.lang.reflect.Method.invokeNative(Native Method)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at java.lang.reflect.Method.invoke(Method.java:511)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
08-24 00:11:14.075: E/AndroidRuntime(7275):	at dalvik.system.NativeStart.main(Native Method)

Very baffling considering I haven't changed anything in my implementation?

Sorry if someone has reported the same issue 10 pages back and I've missed it!

Topical for me - Take a look at my Stackoverflow answer here. Once you've got the short-lived helper Activity in the foreground, I assume you can attach a window to it?