当我尝试在模拟器上运行我的应用程序.splashActivity类没有被直接调用LoginActivity被调用,而当我在我的设备中通过usb运行它会抛出以下异常,
这是一个奇怪的行为,当我删除我的LoginActivity时调用了splashActivity类,并且由于找不到loginactivity而关闭了应用程序,当我恢复启动时,MainActivity一切正常
[2012-11-22 16:59:57 - medeclinicv2] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.kredence.medeclinicv2/.LoginActivity }
[2012-11-22 16:59:57 - medeclinicv2] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.kredence.medeclinicv2/.LoginActivity } from null (pid=5929, uid=2000) requires null
这是我的Manifiest代码,我已经清理了我的项目
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kredence.medeclinicv2"
android:versionCode="2"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".splashActivity"
android:label="@string/app_name">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".LoginActivity"
android:theme="@android:style/Theme.Black.NoTitleBar"
clearTaskOnLaunch = "true" />
<activity
android:name=".viewAppointment"
android:icon="@drawable/minilogo"
android:label="Schedule/View Appointment"
android:windowSoftInputMode="adjustPan"
clearTaskOnLaunch = "true">
</activity>
<activity
android:name=".scheduleActivity"
clearTaskOnLaunch = "true"
android:theme="@android:style/Theme.Black.NoTitleBar">
</activity>
<activity
android:name=".scheduleAppointment"
android:theme="@android:style/Theme.Black.NoTitleBar"
clearTaskOnLaunch = "true">
</activity>
<activity
android:name=".reScheduleAppointment"
android:theme="@android:style/Theme.Black.NoTitleBar"
clearTaskOnLaunch = "true">
</activity>
<!-- <service android:name=".MainActivity"></service> -->
<service android:name="com.commonsware.cwac.updater.UpdateService"/>
<receiver android:name="com.commonsware.cwac.updater.WakefulReceiver"/>
</application>
</manifest>
splashActivity
package com.kredence.medeclinicv2;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
public class splashActivity extends Activity {
protected int _splashTime = 5000;
private Thread splashTread;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
final splashActivity sPlashScreen = this;
// thread for displaying the SplashScreen
splashTread = new Thread() {
@Override
public void run() {
try {
synchronized (this) {
wait(_splashTime);
}
} catch (InterruptedException e) {} finally {
finish();
Intent i = new Intent();
i.setClass(sPlashScreen, LoginActivity.class);
}
}
};
splashTread.start();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
synchronized (splashTread) {
splashTread.notifyAll();
}
}
return true;
}
}
答案 0 :(得分:0)
查看您的Android清单代码。
通常,java.lang.SecurityException
是因为您可以输入两个指向同一活动的条目。删除第二个,你应该很高兴。