我在Android Market上有一个应用程序,并且一直在使用SoundPool类来获得音效.我注意到,在Android API的所有部分中,这似乎给我带来了最多的问题.例如:
HTC Desire在播放WAV文件时遇到问题(这会导致它随机锁定).使用.ogg文件修复此问题
在Droid上,如果超过init设置调用中的通道数:
mSoundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0);
手机会锁定.如果你能想象调试的难度那么大!在我不拥有的手机上.它需要我的客户提供很多无私的帮助.将'4'改为'16'消除了这个问题.我毫不怀疑,如果同时播放16种声音,它仍然会崩溃.值得庆幸的是,这种可能性很低.
我现在已将声音管理器更改为使用MediaPlayer.这似乎现在很好.我只是想知道是否有其他开发人员遇到这些问题?
我正在尝试使用不同的接受语言标题来测试我们的网站.因此,如果接受语言标题为fr,则显示"bonjour",如果接受语言标题为"en",则显示"hello".
我是用selenium webdriver做的,但经过几个小时的网络搜索,我看不到办法.
我发现这篇文章表明这是不可能的(http://code.google.com/p/selenium/issues/detail?id=141)但肯定这是其他人需要做的事情?任何想法的人?
谢谢!
我有一个listView的自定义ArrayAdapter,它位于水平scrollView内.水平滚动工作正常,但对于垂直滚动,我不得不做一些黑客攻击.我只是想知道它是否是一个好主意,因为listView已经针对垂直滚动进行了优化.有没有办法滚动没有这个黑客?
黑客主要是为scrollView(父类)捕获touchEvent并将touchEvent传播到ListView.
scrolLView.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
lv.setSmoothScrollbarEnabled(true);
lv.dispatchTouchEvent(arg1);
}
});
Run Code Online (Sandbox Code Playgroud)
这会导致滚动发生并且事情有效.我只是想知道是否还有一些我需要考虑的事情.
谢谢
我有一个编译成库(dll,静态库等)的代码.我希望这个库的用户使用一些结构来传递一些数据作为库函数的参数.我想过在API头文件中声明结构.
几点说明:
我是android应用程序开发的新手.我正在使用http://developer.android.com/resources/tutorials/views/hello-formstuff.html上给出的Form Stuff示例.在这里我使用了自定义按钮示例.
我的代码如下:
package com.example.helloformstuff;
import android.app.Activity;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class HelloFormStuff extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// Perform action on clicks
Toast.makeText(HelloFormStuff.this, "Beep Bop", Toast.LENGTH_SHORT).show();
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
它显示以下错误:
The type new DialogInterface.OnClickListener(){} must implement the inherited
abstract method …Run Code Online (Sandbox Code Playgroud) 我发现下面的代码非常难以阅读,我写了它!有没有
ClassName::member_function_name为每个实现的成员函数?我在这方面找到了Java DRYer.你不要到处重复类名.谢谢!
template <class KeyType, class ObjectType>
class Vertex
{
private:
KeyType key;
const ObjectType* object;
public:
Vertex(const KeyType& key, const ObjectType& object);
const KeyType getKey();
};
template <class KeyType, class ObjectType>
class Graph
{
private:
map<KeyType, Vertex<KeyType, ObjectType> > vertexes;
public:
const Vertex<KeyType, ObjectType>& createVertex(const KeyType& key, const ObjectType& object);
};
template <class KeyType, class ObjectType>
Vertex<KeyType, ObjectType>::Vertex(const KeyType& objectKey, const ObjectType& newObject)
{
key = objectKey;
object = &newObject;
};
template <class KeyType, …Run Code Online (Sandbox Code Playgroud) 我想创建一个支持Android设备的移动和平板电脑版本的应用程序.我喜欢上传一个apk文件到Android市场来实现这一目标.
它的工作原理如下.
我怎么能这样做.如果我错了,请更正我.
此致,Kariyachan
我知道如何为它创建一个按钮和一个动作监听器.但是我希望它们有几个按钮和actionListeners,它们可以执行彼此无关的单独操作.
例:
protected JButton x;
x = new JButton("add");
x.addActionListener(this);
public void actionPerformed(ActionEvent evt) { //code.....}
Run Code Online (Sandbox Code Playgroud)
现在我想要其他按钮可能有不同的功能,如减法,乘法等,请建议.谢谢
我需要在我的应用程序中播放远程服务器的音频文件.当我使用localhost服务器(使用WAMP)测试时,我可以玩.当从服务器提供相同的文件时它不工作..文件没有扩展名,内容是MP3
String fileUrl = "http://192.168.1.131/myproject/songs/xyz";
String url = "http://myserver/songs/xyz"; //(myserver -> A remote server)
mVideoView.setVideoURI(Uri.parse(fileUrl));
mVideoView.requestFocus();
Run Code Online (Sandbox Code Playgroud)
此外,我需要更好地控制玩家.
请帮忙...
我在布局中添加了一个按钮,并在活动中获得了它的引用:
Button button1=(Button)findViewById(R.id.button1);
button1.setVisiblity(View.Visible);
Run Code Online (Sandbox Code Playgroud)
程序崩溃与此代码.如何正确设置其可见性?
android ×6
audio-player ×1
button ×1
c ×1
c++ ×1
dll ×1
java ×1
localization ×1
selenium-rc ×1
soundpool ×1
struct ×1
swing ×1
tablet ×1
templates ×1
visibility ×1