希望我能做一个测试来验证互联网连接,我不想检查网络状态,因为它只检测我是否在我的设备上激活了互联网,y yo quiero revisar si es posible conectarse a internet.像ping一样的东西.
我在AndEngine练习.我做了一个背景,一个精灵,并增加了运动和重力.
所以我决定练习背景音乐和声音,但我有一个问题.现在,当我启动应用程序时,我得到黑屏,精灵失真,当然音乐不响.
你能帮我吗?这是代码:
public class MainActivity extends BaseGameActivity {
Scene scene;
private Music music;
protected static final int CAMERA_WIDTH = 850;
protected static final int CAMERA_HEIGHT = 480;
BitmapTextureAtlas playerTexture;
ITextureRegion playerTexureRegion;
PhysicsWorld physicsWorld;
@Override
public EngineOptions onCreateEngineOptions() {
// TODO Auto-generated method stub
Camera mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
EngineOptions options = new EngineOptions(true,
ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(), mCamera);
return options;
}
@Override
public void onCreateResources(
OnCreateResourcesCallback pOnCreateResourcesCallback)
throws Exception {
// TODO Auto-generated method stub
loadGfx();
loadSounds(); …Run Code Online (Sandbox Code Playgroud) 我正在做一个动态textview的例子,它是通过按下按钮创建的.它们的创建格式类似于:
1- Textview (fist created)
2- TextView
3- TextView (last created)
Run Code Online (Sandbox Code Playgroud)
我想知道我们是否可以按升序创建它们,一个高于之前的TextView.这样的事情:
3- TextView (last created)
2- TextView
1- TextView (first created)
Run Code Online (Sandbox Code Playgroud)
这是我的示例代码:
private OnClickListener onClick() {
return new OnClickListener() {
@Override
public void onClick(View v) {
mLayout.addView(createNewTextView("TextView"));
count = count +1;
}
};
}
private TextView createNewTextView(String text) {
final LayoutParams lparams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
final TextView textView = new TextView(this);
textView.setLayoutParams(lparams);
textView.setText(count+ "- " + text);
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
return textView;
}}
Run Code Online (Sandbox Code Playgroud)