Joda Time

Joda-Time提供了一组Java类包用于处理包括ISO8601标准在内的date和time。可以利用它把JDK Date和Calendar类完全替换掉,而且仍然能够提供很好的集成。

Install

Joda已经更新到2.6版本,jar包的下载可以到Joda Jar进行下载.
如果使用gradle管理,可添加

1
2
3
dependencies {
compile 'joda-time:joda-time:2.6'
}
阅读全文

Android Activity所涉及的四种Launch Mode与其重要的几个属性,如taskAffinity,allowTaskReparenting等,包括Intent内的各种Flag的功效,一直是为广大开发者所苦恼,网上文章众说纷纭,开发文档又及其模糊且与实际情况有一定偏差,那么今天我们就来真正的揭秘,还原事实的真相。
阅读全文

Robolectric in Android Studio

发布在 Android

Robolectric

Robolectric is a unit test framework that de-fangs the Android SDK jar so you can test-drive the development of your Android app. Tests run inside the JVM on your workstation in seconds. With Robolectric you can write tests like this:

1
2
3
4
5
6
7
8
9
10
11
12
// Test class for MyActivity @RunWith(RobolectricTestRunner.class)
public class MyActivityTest {

@Test public void clickingButton_shouldChangeResultsViewText()
throws Exception {
Activity activity = Robolectric.buildActivity(MyActivity.class).create().get();
Button pressMeButton = (Button) activity.findViewById(R.id.press_me_button);
TextView results = (TextView) activity.findViewById(R.id.results_text_view);

pressMeButton.performClick();
String resultsText = results.getText().toString();
assertThat(resultsText, equalTo("Testing Android Rocks!")); } }

Robolectric makes this possible by rewriting Android SDK classes as they’re being loaded and making it possible for them to run on a regular JVM.


阅读全文
  • 第 1 页 共 1 页

Prince Chen

Xidian B/M EE
热爱生活, 关爱老婆
友情链接 圣骑士


Worker


Xi'an