有没有办法以编程方式在我们的应用程序中以编程方式获取Android设备中所有活动警报的列表.只需指出一些可以提供帮助的链接我基本上试图让用户查看所有警报的工具在他的设备中,所以我想获得设备中所有活动警报的列表.
我试图使用值动画师一个接一个地动画3个图像,但是我无法决定如何在定期间隔后调用三个处理程序.假设有3个图像并且我正在制作三个处理程序来动画它们.但我能够一次带三个图像,但不是一个接一个地定期播放.请帮助
这是我从我的处理程序调用的UpdateListener
public void startAnimation_image(final ImageView aniView) {
animator = ValueAnimator.ofFloat(0, .8f);
animator.setDuration(Constants.ANIM_DURATION);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
int Low = 10;
int High = width-150;
int R = (int) ((Math.random() * (High - Low)) + Low);
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float value = ((Float) (animation.getAnimatedValue())).floatValue();
aniView.setTranslationX(R);
Log.e("mscale",150*mScale +"");
Log.e("value is", value+"");
aniView.setTranslationY((mDisplaySize.bottom + (150*mScale))*value);
x_point = aniView.getTranslationX();
y_point = aniView.getTranslationY();
}
});
animator.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator arg0) {
}
@Override
public void onAnimationRepeat(Animator arg0) {
} …Run Code Online (Sandbox Code Playgroud) 我想得到2个日期之间的月数.日期是某人生日和当前日期.所以我得到两个日期之间的年数而不是月数.
假设我的日期是06/09/2011和06/11/2012.所以我希望答案是1年2个月.我得到的一年而不是月份.请帮助.下面是获取年数的代码
public int getAge(Date dateOfBirth) {
today = Calendar.getInstance();
Calendar birthDate = Calendar.getInstance();
birthDate.setTime(dateOfBirth);
if (birthDate.after(today)) {
throw new IllegalArgumentException("Can't be born in the future");
}
age = today.get(Calendar.YEAR) - birthDate.get(Calendar.YEAR);
month = today.get(Calendar.MONTH) - birthDate.get(Calendar.MONTH);
if ( (birthDate.get(Calendar.DAY_OF_YEAR) - today.get(Calendar.DAY_OF_YEAR) > 3) ||
(birthDate.get(Calendar.MONTH) > today.get(Calendar.MONTH ))){
days = birthDate.get(Calendar.DAY_OF_MONTH) - today.get(Calendar.DAY_OF_MONTH);
age--;
Toast.makeText(getApplicationContext(), "inside if", Toast.LENGTH_SHORT).show();
Log.e("month is",month+"");
Log.e("Days",days+ " left");
}else if ((birthDate.get(Calendar.MONTH) == today.get(Calendar.MONTH )) &&
(birthDate.get(Calendar.DAY_OF_MONTH) > today.get(Calendar.DAY_OF_MONTH ))){
Toast.makeText(getApplicationContext(), …Run Code Online (Sandbox Code Playgroud)