声音不会播放android
|
好的,我知道我并不是接受率最高的人,我会弥补这一点。
我已经按照大量的启动画面教程和方法进行了尝试,但是我有一些可以工作的...但是,声音却无法工作...每当我完成操作时,我都会收到错误消息“无法解决或不是领域\”
任何建议:这是COMPLETE SplashScreen.java代码:
package com.droidnova.android;
import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.MotionEvent;
import android.R;
public class SplashScreen extends Activity {
protected boolean _active = true;
protected int _splashTime = 5000;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
MediaPlayer mpSplash = MediaPlayer.create(this, R.raw.laugh);
mpSplash.start();
// thread for displaying the SplashScreen
Thread splashTread = new Thread() {
@Override
public void run() {
try {
int waited = 0;
while(_active && (waited < _splashTime)) {
sleep(100);
if(_active) {
waited += 100;
}
}
} catch(InterruptedException e) {
// do nothing
} finally {
finish();
startActivity(new Intent(\"com.droidnova.android.splashscreen.MyApp\"));
stop();
}
}
};
splashTread.start();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
_active = false;
}
return true;
}
}
有什么建议么?
更新!
这是AndroidManifest.xml电影的代码:
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"
package=\"com.droidnova.android\"
android:versionCode=\"1\"
android:versionName=\"1.0\">
<application android:icon=\"@drawable/icon\" android:label=\"@string/app_name\">
<activity android:name=\".SplashScreen\"
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=\".MyApp\">
<intent-filter>
<action android:name=\"com.droidnova.android.splashscreen.MyApp\" />
<category android:name=\"android.intent.category.DEFAULT\" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion=\"4\" />
</manifest>
第5行和第6行有错误:
第5行:error: Error: No resource found that matches the given name (at \'label\' with value \'@string/ app_name\').
第6行:error: Error: No resource found that matches the given name (at \'label\' with value \'@string/ app_name\').
添加了R.java:
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.droidnova.android;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int icon=0x7f020000;
}
public static final class id {
public static final int textView1=0x7f050000;
}
public static final class layout {
public static final int main=0x7f030000;
public static final int splash=0x7f030001;
}
public static final class string {
public static final int app_name=0x7f040000;
public static final int main_screen=0x7f040001;
public static final int splash_screen=0x7f040002;
}
}
没有找到相关结果
已邀请:
4 个回复
捅瓶啡
。
吠强祷豪硅
文件夹中有一个名为\“ laugh \”的文件。
谷起
)完全相同,否则您将获得构建时解析错误。
诞胃
文件(例如
)。如果发现其中任何一个,请将其删除,清理您的项目(项目>清理...),然后查看是否可以解决问题。