我正在尝试在ListFragment中显示数据库中的数据.为此,我在使用ListActivity时遵循相同的方式,创建了自己的适配器(适配器可能看起来很奇怪,我从一个在我的旧项目中扩展BaseAdapter的类转换它):
package com.mysys.asistan;
import android.app.ListFragment;
import android.content.Context;
import android.database.DataSetObserver;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import android.widget.TextView;
import com.mysys.asistan.database.Company;
public class CompanyListFragment extends ListFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new CompanyListAdapter(getActivity()));
}
private class CompanyListAdapter implements ListAdapter {
private final Context context;
private DatabaseHelper dbHelper;
public CompanyListAdapter(Context context) {
this.context = context;
this.dbHelper = new DatabaseHelper(context);
}
public int getCount() {
return dbHelper.getCompanyCount();
}
public Object getItem(int position) {
return dbHelper.getAllCompanies().get(position);
}
public …Run Code Online (Sandbox Code Playgroud) 我正在尝试DirectRunner在Google Cloud Dataflow上运行能够成功运行的管道。当我执行此Maven命令时:
mvn compile exec:java \
-Dexec.mainClass=com.example.Pipeline \
-Dexec.args="--project=project-name \
--stagingLocation=gs://bucket-name/staging/ \
... custom arguments ...
--runner=DataflowRunner"
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
No Runner was specified and the DirectRunner was not found on the classpath.
[ERROR] Specify a runner by either:
[ERROR] Explicitly specifying a runner by providing the 'runner' property
[ERROR] Adding the DirectRunner to the classpath
[ERROR] Calling 'PipelineOptions.setRunner(PipelineRunner)' directly
Run Code Online (Sandbox Code Playgroud)
我有意DirectRunner从我的收藏夹中删除pom.xml并添加了以下内容:
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-runners-google-cloud-dataflow-java</artifactId>
<version>2.0.0</version>
<scope>runtime</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我继续删除了<scope>标签,然后调用了options.setRunner(DataflowRunner.class),但没有帮助。PipelineOptions从扩展我自己的界面DataflowPipelineOptions …