我发现这个位置上如何使用〔实施例runOnUiThreaed的方法,但我不知道如何使用它.
我在主要活动中设置了列表适配器
// Set a gobal reference to the list adapter and the list respectivly
ListAdapter listAdapter;
static ArrayList<String> list;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// some code
adapter = new ListAdapter(getActivity(), R.layout.item_layout, list);
listView.setAdapter(adapter);
// some code
}
Run Code Online (Sandbox Code Playgroud)
我在这里调用服务处理程序类的列表适配器
public class ListAdapter {
// some code
ServiceHandler sh = new ServiceHandler();
sh.run();
}
Run Code Online (Sandbox Code Playgroud)
这是我更新列表和列表适配器的类中的.run()方法ServiceHandler
public void run(Adapter listAdapter, ArrayList<String> list){
// some code
list[0] = "foo";
listAdapter.notifyDataSetChanged;
}
Run Code Online (Sandbox Code Playgroud)
但是我在运行时遇到这个错误 …
通过远程查看器,VNC我可以在远程机器上启动 android 模拟器
emulator -avd emu1
Run Code Online (Sandbox Code Playgroud)
但是通过远程机器上的 SSH 我收到错误
emulator: INFO: QtLogger.cpp:68: Warning: could not connect to display ((null):0, (null))
emulator: INFO: QtLogger.cpp:68: Info: Could not load the Qt platform plugin "xcb" in "/opt/androidtest/android-sdk/emulator/lib64/qt/plugins" even though it was found. ((null):0, (null))
Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb.
((null):0, (null))
emulator: INFO: QtLogger.cpp:68: Fatal: This application failed to start …Run Code Online (Sandbox Code Playgroud) 是的,我正在使用Picasso来加载位图.究其原因,我在我的适配器,而在另一个装载位图的一部分解码的URI,和我读到这里是
即使您的URL为空,也应始终致电Picasso.这样它就知道图像视图被回收了.
所以我试过这个....
Bitmap bitMap;
...
Picasso.with(getContext())
.load(bitMap)
.into(imageView);
Run Code Online (Sandbox Code Playgroud)
但我得到了这个错误
无法解析方法'load(android.graphics.Bitmap)'
我有一个AppBarLayout嵌套的内部CoordinatorLayout
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.michael.blemanager.Activities.ColorPickerActivity.Color1">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_color1"/>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
这是包含的布局 content_color1
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.michael.blemanager.Activities.ColorPickerActivity.Color1"
tools:showIn="@layout/activity_color1">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/default_background"
>
/....
</LinearLayout>
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
由于某种原因,AppBarLayout重叠了ConstraintLayout
查看工具栏与色环重叠的位置?如何防止重叠?
我无法找到这个问题的详细答案,或者至少没有找到我能理解的答案.
我正在尝试设置Volley来从iTunes中下载JSON对象.然后我想解析对象,以获取他们的图像URL.
例如,这是iTunes JSON对象URL
String url = "https://itunes.apple.com/search?term=michael+jackson";
Run Code Online (Sandbox Code Playgroud)
所以我在这里设置了我的代码来获取这个对象(当然使用教程)
String url = "https://itunes.apple.com/search?term=michael+jackson";
JsonObjectRequest jsonRequest = new JsonObjectRequest
(Request.Method.GET, url, null, new Downloader.Response.Listener // Cannot resolve symbol Listener
<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
// the response is already constructed as a JSONObject!
try {
response = response.getJSONObject("args");
String site = response.getString("site"),
network = response.getString("network");
System.out.println("Site: "+site+"\nNetwork: "+network);
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Downloader.Response.ErrorListener // Cannot resolve symbol ErrorListener
() {
@Override
public …Run Code Online (Sandbox Code Playgroud) 我是调试器的新手。当我浏览一行代码时,我想知道如何退后一步。现在我意识到代码无法向后执行?如果要退回到旧行,是否必须在调试中重新启动活动?
另外,如果您不介意,什么是force-step-into命令?
如何获取 iOS 模拟器上安装的所有应用程序的捆绑包标识符?
我想通过脚本自动卸载名为 WebDriverAgent(由 Appium 使用)的特定应用程序。
例如
xcrun simctl uninstall booted com.example.apple-samplecode.UICatalog
Run Code Online (Sandbox Code Playgroud) 我正在使用IntelliJ,并且能够通过按下播放按钮,然后从终端运行此命令,通过GUI构建和运行我的Gradle项目
./gradlew --stacktrace deploy
Run Code Online (Sandbox Code Playgroud)
生成此控制台输出,并且构建失败:
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.internal.service.ServiceCreationException: Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:816)
at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:767)
at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectServiceProvider.getInstance(DefaultServiceRegistry.java:571)
at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:628)
at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.assembleParameters(DefaultServiceRegistry.java:780)
at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:766)
at …Run Code Online (Sandbox Code Playgroud) 比方说,我如何获取现有的位图
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.somebitmap);
Run Code Online (Sandbox Code Playgroud)
并编写一个返回位图的黑暗版本的方法?
private Bitmap darkenBitMap(Bitmap bm) { }
Run Code Online (Sandbox Code Playgroud)
到目前为止,我一直在尝试使用Paint和Canvas但没有结果.
当我ANDROIDX_TEST_ORCHESTRATOR在testOptions
testOptions {
unitTests.includeAndroidResources = true
animationsDisabled = true
execution 'ANDROIDX_TEST_ORCHESTRATOR'
}
Run Code Online (Sandbox Code Playgroud)
我运行仪器测试
./gradlew connectedStudioDebugAndroidTest --stacktrace
Run Code Online (Sandbox Code Playgroud)
我收到未找到测试的错误
com.android.builder.testing.ConnectedDevice > No tests found.[emu1(AVD) - 9] FAILED
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @Test annotations).
Run Code Online (Sandbox Code Playgroud)
当我ANDROIDX_TEST_ORCHESTRATOR在testOptions
testOptions {
unitTests.includeAndroidResources = true
animationsDisabled = true
// execution 'ANDROIDX_TEST_ORCHESTRATOR'
}
Run Code Online (Sandbox Code Playgroud)
测试运行。
那么我怎样才能让测试运行ANDROIDX_TEST_ORCHESTRATOR呢?
编辑
我取得了一些进展:androidTests 在我的真实设备 …