【Java-Android PointF构造函数无法在JUnit测试中使用】教程文章相关的互联网学习教程文章

java-匕首:android.content.Context上没有可注入成员.您是否要添加可注入的构造函数?类要求的模块【代码】

我正在尝试将要与Dagger一起注入的单身CookieUtil转换为LoginActivity. CookieUtil为此具有应用程序上下文,我已经建立了以下结构: Android模块@Module(injects = {CookieUtil.class,LoginActivity.class},library = true ) public class AndroidModule {private final App application;public AndroidModule(App application) {this.application = application;}/*** Allow the application context to be injected but require t...

Java-Android PointF构造函数无法在JUnit测试中使用【代码】

我在尝试编写JUnit测试时偶然发现了这一点.诚然,这是我在JUnit中进行的首次单元测试,但是我的确感到非常困惑.package com.example.dom.pointfbugrepro;import android.graphics.PointF; import org.junit.Test; import static org.junit.Assert.*;public class ExampleUnitTest {@Testpublic void pointf_isCorrect() throws Exception {PointF foo = new PointF(5, 0);assertEquals(5, foo.x, 0.0001f);} }在全新的Android项目中运...

java.lang.Exception:自定义运行器类AndroidJUnit4应该有一个带有签名AndroidJUnit4的公共构造函数(Class testClass)【代码】

gradle看起来像:apply plugin: 'com.android.application'android {compileSdkVersion 25buildToolsVersion "25.0.2"defaultConfig {applicationId "com.google.developer.taskmaker"minSdkVersion 19targetSdkVersion 25versionCode 1versionName "1.0"testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"}buildTypes {release {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-an...

java – 在Android上的ListFragment中使用ArrayAdapter获取构造函数错误【代码】

这是我的代码.我收到错误ArraryAdapter上的构造函数ArrayAdapter< String>(MainFragment,int,String [])未定义. 如何使用数组项填充listView1?public class MainFragment extends ListFragment { String[] items = { "12 Monkeys", "(500) Days of Summer", "Chariots of Fire" };@Overridepublic void onCreate(Bundle savedInstanceState) {setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_ite...

java – Android – 活动构造函数【代码】

我注意到使用快捷键Alt Insert并选择构建器,它尝试使用每个私有属性(例如cManager和mTextView)创建构造函数.我记得我已经创建了没有它的项目并且工作正常. 在完整的logcat和Activity构造函数之后运行应用程序时发生错误: 具有私有财产的构造函数:private ConnectivityManager cManager; private TextView mTextView;public SplashScreenActivity() {this.cManager = (ConnectivityManager) this.getSystemService(Context.CONNEC...

java – 如何从Android中的Fragment调用ArrayAdapter构造函数【代码】

我正在尝试将两列ListView添加到我的Android应用程序中.当我创建项目时,我选择了Fragment选项,它通过向左和向右滑动创建了漂亮的导航.所以我的MainActivity扩展了FragmentActivity. 我的问题是当我试图将AddayAdapter添加到ListView时,ArrayAdapter的construstor寻找上下文对象,我不知道要传递它. 这是我得到错误的代码StableArrayAdapter adapter = new StableArrayAdapter(this, R.layout.row , list); listview.setAdapter(adap...

java – Android和GSON抛出No-Args构造函数未找到异常【代码】

我的Android应用程序中存在GSON问题. JSON输入[{"id":"1202","parent_id":"0","agrpcount":"0","disp_order":"1","code":"PROD-NEW","name":"New Products","active":"1"},{"id":"1119","parent_id":"0","agrpcount":"0","disp_order":"2","code":"PROD-VID","name":"\\\"How To\\\" Videos","active":"1"},{"id":"1685","parent_id":"0","agrpcount":"0","disp_order":"3","code":"SUPP-RESOUR","name":"Support Resources","acti...

UNIT - 相关标签