Hi, I'm trying to use inflate while using ViewFlipper to access to the data inside my view. I've done sample project that crashes.
main.xml
< ?xml version="1.0" encoding="utf-8"?>
< ViewFlipper
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
FlipViewBug.java
package android.FlipViewBug;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
public class FlipViewBug extends Activity {
private static LayoutInflater inflater = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
}
When I rotate emulator from horizontal to vertical orientation (CTRL+F11) app crashes with "stopped unexpectedly". If I remove line
inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
app works 'fine'. Am I trying to do something wrong? In my app I have more complex LinnarView that ViewFlipper is nested and the results are the same.
I was checking this on android 1.5, 2.2 and galaxy tab. There is no problem while rotating form vertical view to horizontal.