If that's your whole main.xml, then a few things are missing, notably,
there is no button with id=helpbutt, or any other buttons implied by
"another similar button" comment in the code. You are probably getting a
NullPointerException when calling "help.setOnClickListener".
Post logcat output here, including the part under "Caused by" so this
can be verified.
And you should have a portrait layout, too (either in layout-port or
just layout) so you can handle orientation changes.
-- Kostya
01.03.2011 20:09, xoggoth пишет:
> From various threads I gather that Android should just use layout-land
automatically, I don't add to the java. I have a minimal layout
main.xml in layout-land but when I use Numeric-key 9 or start the
application while it is already in landscape it stops unexpectedly and
displays a window ActivityThread.performLaunchActivity(ActivityThread
$ActivityRecord, Intent) line: 2496 saying source not found.
The same xml works fine in a Hello Android project that this one is
based on and I can't see any relevant differences in settings or
AndroidManifest.xml between the two projects. ScrollView does seem to
be the problem as it works fine if I remove it.
Grateful for any ideas on this.
main.xml in layout-land:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/
android"
android:id="@+id/scrollview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/textview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</ScrollView>
.java
public class InvertsUK extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button help = (Button) findViewById(R.id.helpbutt);
help.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(),
ViewHelp.class);
startActivityForResult(myIntent, 0);
}
});
...another similar button
}
}
Debug:
DalvikVM[localhost:8619]
Thread [<3> main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord,
Intent) line: 2496
Logcat:
03-01 16:54:12.215: INFO/WindowManager(52): Setting rotation to 1,
animFlags=0
03-01 16:54:12.235: INFO/ActivityManager(52): Config changed:
{ scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/1 nav=3/1 orien=2
layout=18}
03-01 16:54:12.365: INFO/UsageStats(52): Unexpected resume of
com.inverts.uk while already resumed in com.inverts.uk
03-01 16:54:17.355: WARN/WindowManager(52): App freeze timeout
expired.
03-01 16:54:17.365: WARN/WindowManager(52): Force clearing freeze:
AppWindowToken{43e20b70 token=HistoryRecord{43cf8088
com.inverts.uk/.InvertsUK}}
03-01 16:54:19.545: DEBUG/dalvikvm(52): GC freed 2894 objects / 156632
bytes in 164ms
--
Kostya Vasilyev -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en