I have created a package, and made a first project - AndroidTest (to familiar with the UI and basic stuff).
The test is completed and then I created another project (AndroidTest2) under the same package. It is to test orientation.
Step 1: The code is very simple.
- Code: Select all
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class AndroidTest2Activity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void onStart() {Log.d("StateInfo", "onStart"); }
public void onResume() {Log.d("StateInfo", "onResume");}
public void onStop() {Log.d("StateInfo", "onStop"); }
public void onPause() { Log.d("StateInfo", "onPause");}
public void onDestroy() {Log.d("StateInfo", "onDestroy"); }
public void onRestart() { Log.d("StateInfo", "onRestart"); }
}
The layout is very simple - main.xml
- Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<EditText
android:id="@+id/txt1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
Then I test it. The layout loads successfully.
Step 2: Then I create a folder - "layout-land" for the landscape under the layout, and another "layout-land/main.xml".
The code is the same except I insert one more EditText.
- Code: Select all
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
Strange things happened here. When I debug, only the Application Title appears and nothing else.
Step 3: Then I remove the "layout-land" and the "layout-land/main.xml" and then debug again. But the Application still shows the Title only.
I cleaned the package and then debug again, same problem.
I tried to uninstall the AndroidTest2 from the emulator and debug again, same problem.
Step 4: I really have no idea why and so I created another project "AndroidTest3" under the same package and insert the same code from Step 2. It worked successfully.
I do not have any idea why. The codes are the same for AndroidTest2 and AndroidTest3 now. But the behaviors are different.
May anybody helps?
Thanks.
Alfred


