我知道这与传递参数有关,但就我而言,一切都是虚空的,那又如何呢?编译时没有错误!
public class MainActivity extends AppCompatActivity {
private PApplet sketch;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FrameLayout frame = new FrameLayout(this);
frame.setId(CompatUtils.getUniqueViewId());
setContentView(frame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
sketch = new MiniEFIS();
PFragment fragment = new PFragment(sketch);
fragment.setView(frame, this);
listen client = new listen();
client.receive();
}
和
public class listen {
public AsyncTask async_client;
@SuppressLint("StaticFieldLeak")
public void receive() {
async_client = new AsyncTask<Void, Void, Void>() {
protected Void doInBackground(Void... params) {
boolean run = true;
try {
... some OK code here
}
} catch (IOException e) {
Log.e("UDP client IOException", "error: ", e);
run = false;
}
return null;
}
};
请帮助提供正确的声明。