我想EditText在Android中以编程方式管理框的高度和宽度.我试过edittext.setWidth(32);和edittext.setEms(50);,但两者都没有工作.请参阅下面的代码,因为我正在使用它EditText在Android中创建动态s.
private EditText createEditText()
{
final LayoutParams lparams = new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
final EditText edittext = new EditText(this);
edittext.setLayoutParams(lparams);
edittext.setWidth(32);
edittext.setEms(50);
return edittext;
}
Run Code Online (Sandbox Code Playgroud) 如何在Android屏幕中创建透明活动点击以关闭按钮自动关闭活动.请提供任何解决方案.
我正在开发锁屏,我想要在冰淇淋三明治和果冻豆中禁用主页按钮,我可以使用以下方法在Android 2.2,2.3中阻止它
@Override
public void onAttachedToWindow() {
// TODO Auto-generate method stub
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
super.onAttachedToWindow();
}
Run Code Online (Sandbox Code Playgroud)
也尝试了这个
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
Run Code Online (Sandbox Code Playgroud)
在这里,我也没有通过onPauseMethod或者获取事件信息onKeyDown
但是这些方法在ICS中对我没有用,如果有任何方法可以取代它,那么让我知道
我在Spring MVC应用程序中使用Spring Security .
JdbcUserDetailsManager 使用以下查询进行初始化以进行身份验证:
select username, password, enabled from user where username = ?
Run Code Online (Sandbox Code Playgroud)
当局正在加载:
select u.username, a.authority from user u join authority a on u.userId = a.userId where username = ?
Run Code Online (Sandbox Code Playgroud)
我想这样做,以便用户可以使用用户名和电子邮件登录.有没有办法修改这两个查询来实现?还是有更好的解决方案?
我正在尝试使用以下代码扩展来播放Toast消息Activity.但是广播没有被另一个人收到Activity,吐司也没有显示出来.有人可以解决我的错误吗?主要活动是SendBroadcast.java
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class SendBroadcast extends Activity {
public static String BROADCAST_ACTION =
"com.unitedcoders.android.broadcasttest.SHOWTOAST";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void sendBroadcast(View v) {
Intent broadcast = new Intent();
broadcast.setAction(BROADCAST_ACTION);
sendBroadcast(broadcast);
}
}
Run Code Online (Sandbox Code Playgroud)
Toast Display Activity是ToastDisplay.java
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.widget.Toast;
public class ToastDisplay extends Activity {
private BroadcastReceiver receiver = new …Run Code Online (Sandbox Code Playgroud) 在这里我正在开发无线电,无线电链接可以是aacp,aac或mpeg格式.我正在使用MultiPlayerjar播放aacp格式并使用默认MediaPlayer播放mpeg格式,我知道MultiPlayer可以播放这两种格式但我根据客户要求使用不同的jar,有没有办法知道流式网址是aacp,aac或mpeg来自ShoutCast7 .html页面?
谢谢
我想通过以下代码从图像序列(在Android上)创建视频:
opencv_core.IplImage image = cvLoadImage("/sdcard/mytest/testimage.jpg");
FFmpegFrameRecorder recorder = new FFmpegFrameRecorder("/sdcard/mytest/test.3gp",256,256);
try {
recorder.setCodecID( CODEC_ID_H263);
recorder.setFormat("3gp");
recorder.setPixelFormat( PIX_FMT_YUV420P);
recorder.start();
for (int i=0;i<10;i++)
{
recorder.record(image);
}
recorder.stop();
}
catch (Exception e){
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
但我没有我的形象,我有绿屏.我的代码中需要更改什么?
以及如何为我的视频添加音频?
我想重新启动我试过的手机
try {
Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "reboot" });
proc.waitFor();
} catch (Exception ex) {
Log.i(TAG, "Could not reboot", ex);
}
Run Code Online (Sandbox Code Playgroud)
而且PowerManager看到我的编码,但设备没有重新启动,在编码中请给出工作代码
ok = (Button)findViewById(R.id.button1);
final PowerManager power = (PowerManager)getSystemService(Context.POWER_SERVICE);
ok.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
power.reboot("fav");
}
});
Run Code Online (Sandbox Code Playgroud) 通过这个例子,我可以将Google+与Android集成,并获取我的信息,如用户ID,网址,个人资料名称和个人资料图片.
我还要获取所有朋友的列表并显示它.
我该怎么做以及哪个类有用?
我的eval()电话是相当密集的,需要大约一秒钟来生成每个解决方案.
因此,生成每个段落元素(然后我附加到dom - document.getElementById('project_euler_solutions').appendChild(p); )需要大约一秒钟.
因此,我希望每个段落在网页上显示大约一秒钟.(所以大约40秒后我会有40段说).
但是,当我单击按钮时,40秒内没有任何操作,然后所有解决方案立即出现.
为什么在更新dom之前等待所有人完成?
我认为每个段落一旦附加到dom就会出现
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.6.2.min.js"></script>
<script src="/statics/project_euler.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
for (var i in window) {
if (i.slice(0,5) == "solve") {
var p = document.createElement('p');
p.innerHTML = "running: " + i;
document.getElementById('project_euler_solutions').appendChild(p);
var p = document.createElement('p');
p.innerHTML = "Solution: " + eval(i + "()");
document.getElementById('project_euler_solutions').appendChild(p);
}
}
});
});
</script>
</head>
<body>
<div id="project_euler_solutions"><button>Calculate solutions</button></button></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我试图在手机启动时开始活动但整个程序没有运行程序中没有错误,请看我的编码(或http://pastebin.com/BKaE4AaU):
autostart.java
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
public class autostart extends BroadcastReceiver
{
public void onReceive(Context arg0, Intent arg1)
{
Intent intent = new Intent(arg0,service.class);
arg0.startService(intent);
Log.i("Autostart", "started");
}
}
Run Code Online (Sandbox Code Playgroud)
service.java
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
import android.widget.Toast;
public class service extends Service
{
private static final String TAG = "MyService";
@Override
public IBinder onBind(Intent intent) {
return null;
}
public void onDestroy() {
Toast.makeText(this, "My Service Stopped", …Run Code Online (Sandbox Code Playgroud) 我尝试了以下代码
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.ListAdapter;
public class Custom_dialogActivity extends Activity {
/** Called when the activity is first created. */
String test[] = {"Security","Data Backup","Missing Device"};
ListAdapter adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
builder.setTitle("My Title");
builder.setInverseBackgroundForced(true);
builder.setIcon(R.drawable.ic_launcher);
builder.setItems(test, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
System.out.println("onClick " + which);
}
});
builder.setAdapter(adapter, …Run Code Online (Sandbox Code Playgroud) 一旦我的主屏幕应用程序'X'安装在设备上,当用户按下主页按钮时,系统会提示他使用默认操作 Android对话框在默认主页和我的X应用程序之间进行选择.
我的用例是继续提示用户 - 虽然不经常使用此默认操作对话框,直到他选择我的应用程序为默认值.
android ×11
dom ×1
ffmpeg ×1
google-plus ×1
home-button ×1
javacv ×1
javascript ×1
jquery ×1
media-player ×1
shoutcast ×1
spring ×1
spring-mvc ×1
streaming ×1
xml ×1