调试Android时出现ActivityManager: Starting: Intent { act=android.intent.action.MAIN c

zhang957411207 2011-04-08 10:26:19
哪位大虾帮帮忙,调试Android时出现ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.zhang/.activity }错误,请问是怎么回事啊,代码都是按书上的,也没别的错误!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
...全文
36300 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
gxj1680 2013-03-12
  • 打赏
  • 举报
回复
在菜单栏:Project - clean,然后重新run就可以了(个人感觉是ecplise的问题) (注:不知道为什么,在工程面板Package Explorer中,在项目上右键 - Source - Clean Up不好用,感觉跟Project - clean效果差很多)
Lori_EM 2011-12-14
  • 打赏
  • 举报
回复
刚开始做调试,觉得好像与他的这条语句的位置有关:
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"></application>
ytmfudukomh 2011-10-08
  • 打赏
  • 举报
回复
yongyuandeni
正解
jimonh 2011-08-29
  • 打赏
  • 举报
回复
请问你的解决了吗? 怎么解决的。我也遇到这问题
水上冰石 2011-07-01
  • 打赏
  • 举报
回复
我也遇到这个问题了,刚解决。
例如从Activity.java转向Other.java,编写Acvity.java的xml文件为main,Other的xml文件的名称为other,把
Other.java的加上这一句:setContentView(R.layout.other);我的是other写成了main(Activity的xml文件),原因就是调用的xml文件混乱了,一定要注意对应
青埂峰石 2011-06-15
  • 打赏
  • 举报
回复
我在实现socket通信时,也遇到客户端起不来的情况,console日志跟上文一样,这怎么解决啊,牛人指点啊
tuneng1988 2011-05-02
  • 打赏
  • 举报
回复
其实就是一个编辑框和一个文本框,一个按钮,然后点击按钮后,文本框中显示编辑框中的内容,有什么好的意见告知一下,谢谢!!!
tuneng1988 2011-05-02
  • 打赏
  • 举报
回复
帮帮忙,急!!!!
我在Debug时,console框中也出现ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.android.Example1/.Example1 }
然后AVD中出现应用程序以外停止,请重试的提示,为什么?

代码如下:
package com.android.Example1;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
//import android.widget.Toast;

public class Example1 extends Activity {
//private static final String TAG = "Example1";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//Listen for button clicks
Button button =(Button)findViewById(R.id.makesure);
button.setOnClickListener(calcExample1);

}

private OnClickListener calcExample1 = new OnClickListener(){
public void onClick(View v){
EditText fieldcontent = (EditText)findViewById(R.id.content);
TextView display = (TextView)findViewById(R.id.display);
display.setText(fieldcontent.getText());
}
};

}


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.Example1"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="请输入内容"
/>


<EditText android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:text=""
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="显示输入内容"
/>
<TextView android:id="@+id/display"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
/>
<Button android:id="@+id/makesure"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="确定"
/>

</LinearLayout>

<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Example1"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
</manifest>



dlut_labor 2011-04-12
  • 打赏
  • 举报
回复
action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
的意思是android首先启动的activity 每一个应用里只能有一个
这样改下就好了:
<activity android:name=".activity"
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">
</activity>
sky-Z 2011-04-12
  • 打赏
  • 举报
回复
具体的错误信息就“ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.zhang/.activity }”这一行?不止吧
yongyuandeni 2011-04-12
  • 打赏
  • 举报
回复
把你代码发出来看看
zhang957411207 2011-04-10
  • 打赏
  • 举报
回复
改过了,哥们,还是那样啊
yongyuandeni 2011-04-09
  • 打赏
  • 举报
回复
<activity android:name=".activity"
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">
<intent-filter >
<action android:name="android.intent.action.result"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
</intent-filter>
</activity>

你这个项目里面两个activity都是android.intent.category.LAUNCHER这个类别的,当然会错了,一个项目只有一个启动类别的。

改成这样:
<activity android:name=".result" />
yongyuandeni 2011-04-09
  • 打赏
  • 举报
回复
一个应用中又能有一个这样配置的,哥们,改下就知道了
yongyuandeni 2011-04-09
  • 打赏
  • 举报
回复
你两个都是这个不行的吧
zhang957411207 2011-04-09
  • 打赏
  • 举报
回复
android.intent.category.LAUNCHER是让程序显示在程序列表中的,和那个没关系
zhang957411207 2011-04-08
  • 打赏
  • 举报
回复
package com.zhang;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class activity extends Activity {
/** Called when the activity is first created. */

private EditText edittext1,edittext2;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button=(Button)findViewById(R.id.button1);
button.setOnClickListener(new my());
}
class my implements OnClickListener{

public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent =new Intent();
String str1=edittext1.getText().toString();
String str2=edittext2.getText().toString();

intent.putExtra("str1", str1);
intent.putExtra("str2", str2);
//intent.setClass(activity.this, result.class);
intent.setClass(activity.this, result.class);
activity.this.startActivity(intent);

}

}
}




package com.zhang;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

public class result extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.result);
TextView tv=(TextView)findViewById(R.id.textView2);
Intent intent=getIntent();
int m=Integer.parseInt(intent.getStringExtra("str1"));
int n=Integer.parseInt(intent.getStringExtra("str2"));
int mn=m*n;
tv.setText(mn+"");
}

}


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zhang"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />

<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".activity"
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">
<intent-filter >
<action android:name="android.intent.action.result"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
</intent-filter>
</activity>

</application>
</manifest>
zhang957411207 2011-04-08
  • 打赏
  • 举报
回复
就是一个Activity通过Intent调用另一个Activity
yongyuandeni 2011-04-08
  • 打赏
  • 举报
回复
把你代码贴出来

80,359

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧