我有以下字符串:
Mon Sep 14 15:24:40 UTC 2009
Run Code Online (Sandbox Code Playgroud)
我需要将其格式化为这样的字符串:
14/9/2009
Run Code Online (Sandbox Code Playgroud)
我如何用Java做到这一点?
不知道下面的表述是否正确:
<property name="cronExpression" value="0 0 12 2 * MON-FRI ?"/>
Run Code Online (Sandbox Code Playgroud)
我尝试将我的触发器配置为每个月的第二天触发,无论年份如何,中午,一周中的某一天必须在周一和周五之间。
如果有人可以帮助我,我将不胜感激。提前致谢。
在过去的日子里,像sourceforge.org这样的项目托管网站为每个项目提供了详细的(下载)统计数据.这对我来说是有用的,可以帮助我找到更受欢迎的项目(因此更加"安全"和面向未来).但我认为这对这些项目的开发者来说也很重要.
我是Maven的新手,并没有找到任何类似的统计数据,只有Maven Central的"快速统计数据".
Maven概念(和Nexus)是否提供了详细的统计信息:特定工件作为特定类型下载了多少(如jar,pom等?).如果是,我在哪里可以找到它(例如Hibernate)?
我有一个带有表单的Web应用程序.当我单击保存时,应用程序创建一些文件并返回一些URL.我如何将此网址显示到网页?
这个问题询问如何知道Android Talkback是否有效; 直到果冻豆工作.从Android 4.1开始,该步骤不再起作用,因为提到的游标为空.
说完这个,我想问一下是否有办法在Jelly Bean中进行相同的检查.
编辑 我试图搜索TalkBack代码,我在这里找到它.要检查TalkBack是否处于活动状态,我使用以下代码:
Intent screenReaderIntent = new Intent("android.accessibilityservice.AccessibilityService");
screenReaderIntent.addCategory("android.accessibilityservice.category.FEEDBACK_SPOKEN");
List<ResolveInfo> screenReaders = getPackageManager().queryIntentServices(screenReaderIntent, 0);
Cursor cursor = null;
ContentResolver cr = getContentResolver();
for (ResolveInfo screenReader : screenReaders) {
cursor = cr.query(Uri.parse("content://" + screenReader.serviceInfo.packageName
+ ".providers.StatusProvider"), null, null, null, null);
//here, cursor is not null, but calling cursor.moveToFirst() returns false, which means the cursor is empty
}
Run Code Online (Sandbox Code Playgroud)
有了这个说,如果光标为空,我们怎么知道TalkBack是否正在运行?
编辑2 在@JoxTraex建议之后,我现在发送广播来查询是否启用了TalkBack:
Intent i = new Intent();
i.setAction("com.google.android.marvin.talkback.ACTION_QUERY_TALKBACK_ENABLED_COMMAND");
sendBroadcast(i);
Run Code Online (Sandbox Code Playgroud)
现在我应该如何收到回复?
我尝试将以下内容添加到清单中,但我的接收方没有收到任何响应:
<receiver android:name="my.package.MyBroadcastReceiver"
android:permission="com.google.android.marvin.talkback.PERMISSION_SEND_INTENT_BROADCAST_COMMANDS_TO_TALKBACK">
<intent-filter> …Run Code Online (Sandbox Code Playgroud) 我有一个自定义控件(现在很简单)就像一个按钮.它需要显示未按下和按下的图像.它在活动中出现多次,并且具有不同的图像对,具体取决于它的使用位置.想想工具栏图标 - 与此类似.
这是我的布局的摘录:
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:MyApp="http://schemas.android.com/apk/res/com.example.mockup"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow>
<com.example.mockup.ImageGestureButton
android:id="@+id/parent_arrow"
android:src="@drawable/parent_arrow"
MyApp:srcPressed="@drawable/parent_arrow_pressed"
... />
...
</TableRow>
</TableLayout>
Run Code Online (Sandbox Code Playgroud)
attrs.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="ImageGestureButton">
<attr name="srcPressed" format="reference" />
</declare-styleable>
</resources>
Run Code Online (Sandbox Code Playgroud)
并且,在R.java中,人们发现:
public static final class drawable {
public static final int parent_arrow=0x7f020003;
public static final int parent_arrow_pressed=0x7f020004;
...
}
Run Code Online (Sandbox Code Playgroud)
在窗口小部件实例化期间,我想确定活动xml中声明的id.我怎么做?我试过这个(我使用工作代码更新了我原来的帖子;所以,以下工作.)
public class ImageGestureButton extends ImageView
implements View.OnTouchListener
{
private Drawable unpressedImage;
private Drawable pressedImage;
public ImageGestureButton (Context context, AttributeSet attrs)
{
super(context, attrs);
setOnTouchListener (this);
unpressedImage = …Run Code Online (Sandbox Code Playgroud) android custom-widgets android-drawable android-custom-attributes
我是Wicket的新手,想了解这个框架是如何工作的.
在普通的Java应用程序中,程序计数器在main方法中启动.为了从一开始就理解应用程序,我通常会在此方法的开头放置eclipse断点并继续步骤.
我的问题是,当Wicket应用程序启动时,首先会发生什么?如何在一些Wicket应用程序中遵循序列?
我正在为视频流制作一个媒体播放器.工作正常,但是当我按下主页按钮比活动再次在背景中打开媒体播放器比从开始开始没有恢复.比如何在媒体播放器中恢复视频.这是我的代码
public class VideoSample extends Activity implements OnSeekBarChangeListener, Callback, OnPreparedListener, OnCompletionListener, OnBufferingUpdateListener,
OnClickListener, OnSeekCompleteListener, AnimationListener {
private TextView textViewPlayed;
private TextView textViewLength;
private SeekBar seekBarProgress;
private SurfaceView surfaceViewFrame;
private ImageView imageViewPauseIndicator;
private MediaPlayer player;
private SurfaceHolder holder;
private ProgressBar progressBarWait;
private Timer updateTimer;
private Bundle extras;
private Animation hideMediaController;
private LinearLayout linearLayoutMediaController;
private static final String TAG = "log_tag";
private boolean b =false;
private int seekint,seeksec;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.customvideoview);
extras = getIntent().getExtras();
linearLayoutMediaController = (LinearLayout) …Run Code Online (Sandbox Code Playgroud) 我有两个逻辑类别的测试:简单的功能单元测试(通过/失败)和基准性能测试,仅用于度量/诊断.
目前,我在一个类中有所有测试方法,称之为MyTests:
public class MyTests
{
@Test
public void testUnit1()
{
...
assertTrue(someBool);
}
@Test
public void testUnit2()
{
...
assertFalse(someBool);
}
@Test
@Category(PerformanceTest.class)
public void bmrkPerfTest1()
{
...
}
@Test
@Category(PerformanceTest.class)
public void bmrkPerfTest2()
{
...
}
}
Run Code Online (Sandbox Code Playgroud)
然后我有一个UnitTestSuite定义为
@RunWith(Categories.class)
@Categories.ExcludeCategory(PerformanceTest.class)
@SuiteClasses({ MyTests.class })
public class UnitTestSuite {}
Run Code Online (Sandbox Code Playgroud)
和a PerformanceTestSuite
@RunWith(Categories.class)
@Categories.IncludeCategory(PerformanceTest.class)
@SuiteClasses({ MyTests.class })
public class PerformanceTestSuite {}
Run Code Online (Sandbox Code Playgroud)
所以我可以Ant单独从性能测试中运行单元测试(我不认为包含Ant代码是必要的).
这意味着我总共有四个类(MyTests,PerformanceTest,PerformanceTestSuite和UnitTestSuite).我意识到我可以将所有单元测试放在一个类中,并在另一个类中进行基准测试并完成它,而不会增加类别和额外注释的复杂性.我在Ant中调用类名测试,即不在包中运行所有测试.
是否有意义以及使用注释按类别组织它的原因是什么?如果我只是在两个简单的测试类中重构它会更好吗?
你们知道我可以用什么方式来保护我的properties文件,这样只有我的程序可以改变它吗?properties如果可能的话,我不希望有人能够读取文件.
java ×6
android ×3
wicket ×2
categories ×1
date-format ×1
junit ×1
junit4 ×1
maven ×1
nexus ×1
properties ×1
security ×1
talkback ×1