我在Eclipse中创建了一个简单的"Hello World"程序.我什么都不添加到Java文件,只在文件中添加一个文本视图main.xml
作为
//main.xml file
<?xml version="1.0" encoding="utf-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="Hello World"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
现在,当我运行我的程序时,它会在控制台中显示以下内容.
//console output
[2011-07-10 07:10:22 - demo] ------------------------------
[2011-07-10 07:10:22 - demo] Android Launch!
[2011-07-10 07:10:24 - demo] adb is running normally.
[2011-07-10 07:10:24 - demo] Performing com.demo.DemoActivity activity launch
[2011-07-10 07:10:25 - demo] Automatic Target Mode: launching new emulator with compatible AVD 'vishal'
[2011-07-10 07:10:25 - demo] Launching a new emulator with Virtual Device 'vishal' …
Run Code Online (Sandbox Code Playgroud) 我有设置标签作为UPDATE 29/05/2015 这篇文章.标签在我的Nexus 4手机上占据全宽,但在nexus 7平板电脑上占据中心位置而不是覆盖全屏宽度.
Nexus 7截图
Nexus 4截图
我正在研究社交移动应用.它可以选择录制个人资料视频.我的刻录机的问题是它反映了实际的视频.我知道这是默认行为,但希望它像sanpchat一样工作.
预习
录制和播放后
这是我的代码
// return camera instance when activity open first time
private Camera getCameraInstance() {
// TODO Auto-generated method stub
releaseCamera();
releaseMediaRecorder();
Camera c = null;
try {
cameraId = findFrontFacingCamera();
if (cameraId < 0) {
cameraId = findBackFacingCamera();
}
c = Camera.open(cameraId);
// setCameraDisplayOrientation(this,cameraId,c);
//setCameraDisplayOrientation(this, cameraId, c);
c.setDisplayOrientation(90);
} catch (Exception e) {
// Camera is not available (in use or does not exist)
}
return c; // returns null if camera is unavailable
}
// return …
Run Code Online (Sandbox Code Playgroud) android video-recording android-camera android-mediaplayer android-mediarecorder
我正在绘制一个绘图应用程序,我想用手指触摸移动屏幕绘制心形.所以我将BitmapShader设置为如下代码
//Initialize the bitmap object by loading an image from the resources folder
Bitmap fillBMP = BitmapFactory.decodeResource(context.getResources(), R.drawable.heart);
fillBMP = Bitmap.createScaledBitmap(fillBMP, 20, 20, false);
//Initialize the BitmapShader with the Bitmap object and set the texture tile mode
shader= new BitmapShader(fillBMP, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
Run Code Online (Sandbox Code Playgroud)
然后我分配着色器绘画对象.
paint.setShader(preset.shader);
Run Code Online (Sandbox Code Playgroud)
我还设置了触摸监听器来跟踪用户手指.在用户触摸时,我在canvas对象上绘制为.
Path path = new Path();
path.moveTo(mid1.x, mid1.y);
path.quadTo(midmid.x, midmid.y, mid2.x, mid2.y);
canvas.drawPath(path, paint);
Run Code Online (Sandbox Code Playgroud)
这给了我这个
有些心形被歪曲,而且这些都是重复的.我想要的不是这些重复而且永远不会像这样发作.
提前致谢.
我通过点击部署选项在Google compute Engine中设置了Redis群集.现在我想从我的节点js代码连接到这个redis服务器使用'ioredis'这里是我的代码连接到redis的单个实例
var Redis = require("ioredis");
var store = new Redis(6379, 'redis-ob0g');//to store the keys
var pub = new Redis(6379, 'redis-ob0g');//to publish a message to all workers
var sub = new Redis(6379, 'redis-ob0g');//to subscribe a message
var onError = function (err) {
console.log('fail to connect to redis ',err);
};
store.on('error',onError);
pub.on('error',onError);
sub.on('error',onError);
Run Code Online (Sandbox Code Playgroud)
它奏效了.现在我想连接到redis作为集群,所以我将代码更改为
/**
* list of server in replica set
* @type {{port: number, host: string}[]}
*/
var nodes =[
{ port: port, host: …
Run Code Online (Sandbox Code Playgroud) cluster-computing redis node.js node-redis google-cloud-console