Been working on this issue for a number of days and I can't for the life of me determine whats causing it. I've tried placing breakpoints all over the place. Stepping through the code. I can't see anywhere in my code where I screwed something up. When debugging the application, the only irregular logcat output takes place while launching a second activity. In the emulator the screen goes black, and the application hangs. Logcat's final few lines display:
I/ActivityManager( 59): Starting activity: Intent { cmp=com.testapp/.result
W/ActivityManager( 59): Launch timeout has expired, giving up wake lock!
W/ActivityManager( 59): Activity idle timeout for HistoryRecord{45048110 com.test/.result}
Obviously I've done something wrong with the way I'm calling the second activity, so I figured I'd just display everything I've written specific to that point and see if anyone in the community can see something I'm missing.
Application manifest is as follows:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.manskills"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/launcher" android:label="@string/app_name">
<activity android:name=".testapp"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".result"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
The portion of my code which is calling the second activity is as follows:
lv.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView parent, View v, int position, long id)
{
String cat = lv.getAdapter().toString();
Intent i = new Intent(testapp.this, result.class );
i.putExtra("category", cat);
i.putExtra("skill", lv.getSelectedItemPosition());
testapp.this.startActivity(i);
}
}
And the second activity class i开发者_开发百科s contained in a separate java file as follows:
public class result extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.result);
TextView tv_title = (TextView) findViewById(R.id.skill_title);
ImageView iv1 = (ImageView) findViewById(R.id.skill_pic1);
TextView tv1 = (TextView) findViewById(R.id.skill_text1);
Bundle bund = getIntent().getExtras();
String cat = bund.getString("category");
int skill = bund.getInt("skill"); }
The xml layout file for the second activity is a simple relative layout with some text views and image views. I'm lost in the sauce here as to what I'm doing wrong. Can anyone point anything out?
精彩评论