嗨,我是Android开发的新手.我想用java让我的android手机保持沉默.搜索谷歌后,我发现了一些例子,但他们没有为我工作.这是我的代码.
package com.zafar.silent;
import android.app.Activity;
import android.content.Context;
import android.media.AudioManager;
import android.os.Bundle;
public class Silent extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AudioManager audiomanage = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
audiomanage.setRingerMode(AudioManager.RINGER_MODE_SILENT);
}
}
Run Code Online (Sandbox Code Playgroud)
有人可以帮我,我怎么能跑这个?
提前致谢
更新
这是我的清单文件
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zafar.silent"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".Silent"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
我更新了menifest文件
我有一个id容器的div标签.如何使用jquery或javascript找到它的中心?
<div id="container"></div>
Run Code Online (Sandbox Code Playgroud)
这是css
#container {
width: 300px;
height: 300px;
border: 1px solid red;
}
Run Code Online (Sandbox Code Playgroud) 我在android中的EditText中使用setError()方法.它确实显示弹出窗口,但文本是不可见的.看起来文字的颜色与白色背景相同.我使用以下代码使其工作,但文本仍然不可见.
int ecolor = 65793;
String estring = "Input is incorrect";
ForegroundColorSpan fgcspan = new ForegroundColorSpan(ecolor);
SpannableStringBuilder ssbuilder = new SpannableStringBuilder(estring);
ssbuilder.setSpan(fgcspan, 0, estring.length(), 0);
customPriceInput.setError(ssbuilder);
Run Code Online (Sandbox Code Playgroud)
我怎样才能使它工作?
脚本
我正在使用骨干网建立联系经理.我有一个表单,当用户输入数据并按下提交按钮时,用户的数据将转到服务器并保存在数据库中.
问题
它确实有效,直到将其添加到数据库.但是,我还希望在添加到数据库后更新集合.出于这个原因,我使用以下代码行来更新集合.
addContact: function (e) {
e.preventDefault();
this.collection.create({
first_name: this.$('#first_name').val(),
last_name: this.$('#last_name').val(),
email_address: this.$('#email_address').val(),
description: this.$('#description').val()
}, { wait: true });
console.log(this.collection);
}
Run Code Online (Sandbox Code Playgroud)
上面的函数确实将数据添加到数据库,但它不会更新集合.但是当我删除{wait: true}它然后它确实更新了这个集合.
题
为什么wait: true不允许更新集合以及如何使其与之一起使用wait: true?
UPDATE
我还添加了回调函数,如下所示
{wait: true, success: this.successCallback}
Run Code Online (Sandbox Code Playgroud)
并添加了这样的功能
successCallback: function (collection) {
console.log('call back');
console.log(this.collection);
}
Run Code Online (Sandbox Code Playgroud)
但它在控制台中没有显示此功能?
更新2
错误功能截图

更新3
xhr截图

我正在使用sencha touch在移动网络应用程序上工作.我使用以下代码创建了一个按钮
{
xtype: 'button',
cls: 'messagesBtn'
}
Run Code Online (Sandbox Code Playgroud)
在App.scss中我添加了以下css,它将此按钮的背景更改为图像
.messagesBtn {
height: 50%;
background: url(../images/home.png) no-repeat;
}
Run Code Online (Sandbox Code Playgroud)
现在这个css工作但是当我按下那个按钮然后它不会删除那些图像并添加另一个我不想要的状态.我想当用户按下此按钮时,应该用当前的图像替换另一个图像.我怎样才能做到这一点?
UPDATE
我更改了代码并添加了pressedCls
{
xtype: 'button',
cls: 'messagesBtn',
pressedCls: 'x-button-pressed'
}
Run Code Online (Sandbox Code Playgroud)
这是css
.messagesBtn {
background: url(../images/home.png) no-repeat;
}
.x-button-pressed {
background: url(../images/appointments.png) no-repeat;
}
Run Code Online (Sandbox Code Playgroud)
以上也不起作用.
我按照grunt网站上的文档.执行后sudo npm install -g grunt-cli我得到了这个输出
npm http GET https://registry.npmjs.org/grunt-cli
npm http 304 https://registry.npmjs.org/grunt-cli
npm http GET https://registry.npmjs.org/findup-sync
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/resolve
npm http 304 https://registry.npmjs.org/resolve
npm http 304 https://registry.npmjs.org/findup-sync
npm http 304 https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/abbrev
npm http 304 https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/minimatch
npm http 304 …Run Code Online (Sandbox Code Playgroud) 我想用javascript解决Bliffoscope数据分析问题.我有以下问题.
这是SlimeTorpedo
+
+
+++
+++++++
++ ++
++ + ++
++ +++ ++
++ + ++
++ ++
+++++++
+++
Run Code Online (Sandbox Code Playgroud)
这是TestData
+ + + ++ + +++ + +
+ ++ + + ++++ + + + + + + +++ +++ +
+ + + ++ ++ ++ + ++ + + + + +
+ ++ + ++ + + + ++ ++ + +
++++++ + + + ++ + + + + ++ + + …Run Code Online (Sandbox Code Playgroud) 我尝试做一个简单的服务.这是学习如何创建服务.在我的代码中,当我点击开始按钮然后它确实向我显示说服务开始的吐司,但当我点击停止按钮然后它没有显示我的吐司说服务停止.我的logcat中也没有出现任何错误.这是我的代码
package com.zafar.batterynotify;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class BatteryNotify extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button startButton = (Button) findViewById(R.id.start);
Button stopButton = (Button) findViewById(R.id.stop);
startButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
startService(new Intent(getBaseContext(), BatteryService.class));
}
});
stopButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
stopService(new …Run Code Online (Sandbox Code Playgroud) 我忘记了mysql的root密码.我该怎么办呢?我正在尝试使用mysql -u root命令,但我收到此错误ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
我怎么解决这个问题?
我在JavaScript: The Good Parts书中读到了以下几种功能.就是这样的.
var Foo = function NameOfFunction() {
};
Run Code Online (Sandbox Code Playgroud)
我根本不懂这个功能.如果有人能够解释这一点并且如何使用它会很棒?
本书的确切代码如下,主要用于递归
var walk_the_DOM = function walk(node, func) {
func(node);
node = node.firstChild();
while (node) {
walk(node, func);
node = node.nextSibling;
}
};
Run Code Online (Sandbox Code Playgroud) javascript ×5
android ×3
java ×3
jquery ×2
node.js ×2
algorithm ×1
backbone.js ×1
gruntjs ×1
mysql ×1
sencha-touch ×1