我需要测试包含带按钮的WebView的Android应用程序.
Monkeyrunner适用于除WebView之外的应用程序的所有部分.WebView中的按钮忽略了Monkeyrunner的触摸.我看到该按钮被点击,因为它变成了灰色,但是按钮什么也没做.如果我在模拟器上使用鼠标或在真实设备上使用鼠标,那么按钮效果很好.
我从logcat看到触摸事件已发送到应用程序,但该应用程序没有任何操作.
一些代码:
final WebView w = (WebView) findViewById(R.id.webView1);
String summary = "<html><body><b>Google</b><form action=http://google.com><input type=submit><input type=text></form></body></html>";
w.loadData(summary, "text/html", null);
Run Code Online (Sandbox Code Playgroud)
布局:
<Button android:id="@+id/button1" android:text="Click me!" />
<WebView android:id="@+id/webView1" />
Run Code Online (Sandbox Code Playgroud)
Monkeyrunner py:
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
device = MonkeyRunner.waitForConnection(10)
# android.widget.Button COORDINATES - THIS WORKS FINE
device.touch(10,100, 'DOWN_AND_UP')
# WEBVIEW BUTTON COORDINATES - BUTTON DOESN'T WORK
device.touch(200,200, 'DOWN_AND_UP')
Run Code Online (Sandbox Code Playgroud)
我曾尝试单独DOWN延迟UP - 相同的结果.来自Python或Java内部的Monkeyrunner也不起作用.像ChimpChat这样的monkeyrunner的味道和包装不起作用.
我认为它应该可行,因为有很多web/HTML5应用程序,并且所有这些应用程序都没有经过测试.但它似乎相反.有关如何为WebView组件强制执行触摸事件的任何想法或建议?
我有单线程进程,执行了很长时间.我需要几个用户才能访问执行此过程,我选择http协议来管理调用.
当然,当一个过程正在运行时,其他人应该等到它完成.如果进程可用,则执行.如果没有,则发送BUSY应答.
这是实施:
using System;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
namespace simplehttp
{
class Program
{
private static System.AsyncCallback task;
private static System.Threading.ManualResetEvent mre = new System.Threading.ManualResetEvent(false);// Notifies one or more waiting threads that an event has occurred.
private static HttpListenerContext workingContext = null;
public static bool isBackgroundWorking()
{
return mre.WaitOne(0);
}
static void Main(string[] args)
{
new Thread(() =>
{
Thread.CurrentThread.IsBackground = true;
while (true)
{
Console.WriteLine(" waitOne " + isBackgroundWorking());
mre.WaitOne(); // Blocks …Run Code Online (Sandbox Code Playgroud) 我们有包含很多东西的大型数据库,我想使用版本控制 (Git) 来管理更改。有很多文章如何一步一步地做到这一点,但对我来说缺少一篇。整个数据库的文件结构(不包括数据)是否有标准或推荐的方法以及如何从现有数据库中获取?
它有很多源、过程、函数、包等。版本控制文章展示了如何从版本控制的角度管理少数文件。但是他们建议应该选择每个文件并分别保存到文件系统中。
有没有办法将所有东西导出/导入到某些预先组织的结构中?好的 IDE 具有由语言或产品定义的此类结构。但在我看来,SQL Developer 没有。我还发现 SQL Developer 可能只有一个存储库。没有可以在单独的单元中组合或联合不同数据库的项目的概念。
我应该发明我的整个结构并使用类似的东西
**project/Abc/DB1/Packages/packzgeXyz/source1.sql**
Run Code Online (Sandbox Code Playgroud)
每个来源?当然我可以做到这一点,但我担心可能会错过一些东西。有什么建议吗?
我试图使用ListView将一些项目从PHP填充到Android
public class ChooseCategory extends ListActivity {
private ListView lv;
ArrayAdapter<FoodStores> arrayAdapter;
private static final String TAG = MainActivity.class.getSimpleName();
private ArrayList<FoodStores> storefoodList;
// JSON parser class
JSONParser jsonParser = new JSONParser();
//ids
private static final String TAG_SUCCESS = "success";
private static final String TAG_MESSAGE = "message";
private String URL_STORES = "http://www.123.com/get_stores.php";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);
//lv = (ListView) findViewById(R.id.list_item);
lv = (ListView)findViewById(android.R.id.list);
storefoodList = new ArrayList<FoodStores>();
new GetFoodStores().execute();
arrayAdapter = new ArrayAdapter<FoodStores> (this,R.layout.restaurant_list,storefoodList );
private class …Run Code Online (Sandbox Code Playgroud)