Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
661 views
in Technique[技术] by (71.8m points)

android - Activity refuses to start

Now my first Activity is displaying fine, but clicking the button does not bring up the next Activity. I stepped through this code:

@Override
public void onClick(View v) {
Intent configure = new  Intent(OnDemandAndAutomatic_Activity.this, Configure_Activity.class);  
OnDemandAndAutomatic_Activity.this.startActivity(configure);
}

...and it seemed to run fine, but nothing happened, except breaking me into the Debug Perspective, with this verbiage in the Console pane:

[2012-02-01 21:01:35 - ddms] execute: returning
[2012-02-01 21:01:35 - Unexpected error while launching logcat. Try reselecting the device.] device not found
com.android.ddmlib.AdbCommandRejectedException: device not found
    at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:736)
    at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:373)
    at com.android.ddmlib.Device.executeShellCommand(Device.java:372)
    at com.android.ddmuilib.logcat.LogCatReceiver$1.run(LogCatReceiver.java:100)
    at java.lang.Thread.run(Unknown Source)"

...any ideas on what might cause this?

Update: I also tried changing the button click code to this:

Intent configure = new  Intent(this, Configure_Activity.class);  
startActivity(configure);

...but it makes no difference.

The last line in Console is:

[2012-02-01 21:31:46 - ddms] Forwarding client reply 0x166 to [Debugger 8647-->390 active]

There is nothing in LogCat...?!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Dang my confounded carcass!

The problem was I had neglected to add the Activity to be started to the Manifest!

Excuse me while I go and berate myself mercilessly.

Actually, I'm just happy to have realized my egregious blunder.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...