我在“onActivityResult”上收到错误消息,指出“onActivityResult(int, int, Intent) 未定义对象类型”
我看过有同样问题的人,他们说这是由于花括号放置不当造成的。我试图重新定位它们,但不断出现越来越多的错误。
希望有人可以帮助我解决这个问题:
package com.website.test;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.util.Log;
import android.widget.EditText;
public class ListmenuActivity extends Activity {
@Override
protected void onCreate(Bundle saveInstanceState) {
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(saveInstanceState);
setContentView(R.layout.activity_listmenu);
EditText CPU = (EditText) findViewById(R.id.autoCompleteTextView4);
CPU.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent CPUList = new Intent(getApplicationContext(),
CPUList.class);
startActivityForResult(CPUList, 1);
}
});
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == 1)
;
Intent i = getIntent();
String product = data.getStringExtra("product");
EditText CPU = ((EditText) findViewById(R.id.autoCompleteTextView4));
CPU.setText(product);
}
EditText RAMList = (EditText) findViewById(R.id.autoCompleteTextView1);
RAMList.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent RAMList = new Intent(getApplicationContext(),
RAMList.class);
startActivityForResult(RAMList,1);
}
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == 1)
;
Intent i = getIntent();
String product = data.getStringExtra("product");
EditText RAM = ((EditText) findViewById(R.id.autoCompleteTextView4));
RAM.setText(product);
}
}
});
}
}