Android应用程序在模拟器上显示数据,但在真实设备上不显示
一些移动设备显示数据,如Sony Xperia Acro S、zenfone、中国乐队,而另一些设备不显示数据,如三星、Sony Xperia M5。我不知道是什么问题。请帮帮我,提前谢谢大家。代码如下:Android应用程序在模拟器上显示数据,但在真实设备上不显示,android,Android,一些移动设备显示数据,如Sony Xperia Acro S、zenfone、中国乐队,而另一些设备不显示数据,如三星、Sony Xperia M5。我不知道是什么问题。请帮帮我,提前谢谢大家。代码如下: public class ActivityForm5 extends Activity { //ListView lv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(saved
public class ActivityForm5 extends Activity {
//ListView lv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_form5);
final String NAMESPACE = "http://webapp.ombudsman.go.th/Mobile_WService";
final String URL = "http://webapp.ombudsman.go.th/mobile_wservice/service.asmx";
final String SOAP_ACTION = "http://webapp.ombudsman.go.th/Mobile_WService/ComplainDetail";
final String METHOD_NAME = "ComplainDetail";
final String CpID = getIntent().getStringExtra("cp_id");
SoapObject table = null; // Contains table of dataset that returned through SoapObject
SoapObject client = null; // Its the client petition to the web service
SoapObject tableRow = null; // Contains row of table
SoapObject responseBody = null; // Contains XML content of dataset
HttpTransportSE transport = null; // That call webservice
SoapSerializationEnvelope sse = null;
sse = new SoapSerializationEnvelope(SoapEnvelope.VER11);
////sse.addMapping(NAMESPACE, "movie", this.getClass());
sse.addMapping(NAMESPACE, "ActivityForm5", this.getClass()); //Note if class name isn't "movie" ,you must change
sse.dotNet = true; // if WebService written .Net is result=true
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
//movie setmovie = new movie();
try
{
client = new SoapObject(NAMESPACE, METHOD_NAME);
client.addProperty("p_cp_id", CpID);
sse.setOutputSoapObject(client);
sse.bodyOut = client;
androidHttpTransport.call(SOAP_ACTION, sse);
// This step: get file XML
responseBody = (SoapObject) sse.getResponse();
// remove information XML,only retrieved results that returned
responseBody = (SoapObject) responseBody.getProperty(1);
// get information XMl of tables that is returned
table = (SoapObject) responseBody.getProperty(0);
//Get information each row in table,0 is first row
tableRow = (SoapObject) table.getProperty(0);
TextView txtRunningNo = (TextView)findViewById(R.id.RunningNo);
txtRunningNo.setText(tableRow.getProperty("RUNNING_NO").toString());
TextView txtChannal = (TextView)findViewById(R.id.Channal);
txtChannal.setText(tableRow.getProperty("CHANNEL_NAME").toString());
TextView txtDate = (TextView)findViewById(R.id.Date);
txtDate.setText(tableRow.getProperty("RUNNING_DATE").toString());
TextView txtDep = (TextView)findViewById(R.id.Dep);
txtDep.setText(tableRow.getProperty("RESPONSE_GROUP").toString());
TextView txtAgent = (TextView)findViewById(R.id.Agent);
txtAgent.setText(tableRow.getProperty("RESPONSE_NAME").toString());
TextView txtPresentDo = (TextView)findViewById(R.id.PresentDo);
txtPresentDo.setText(tableRow.getProperty("PROCESS_NAME").toString());
TextView txtStatus = (TextView)findViewById(R.id.Status);
txtStatus.setText(tableRow.getProperty("END_STATUS").toString());
TextView txtPerson= (TextView)findViewById(R.id.Person);
txtPerson.setText(tableRow.getProperty("NAME").toString());
TextView txtOgn = (TextView)findViewById(R.id.Ogn);
txtOgn.setText(tableRow.getProperty("ORG_NAME").toString());
TextView txtType= (TextView)findViewById(R.id.Type);
txtType.setText(tableRow.getProperty("ATTRIBUTE_NAME").toString());
TextView txtIssue= (TextView)findViewById(R.id.Issue);
txtIssue.setText(tableRow.getProperty("Issue_Detail").toString());
TextView txtProblem= (TextView)findViewById(R.id.Problem);
txtProblem.setText(tableRow.getProperty("subIssue_Detail").toString());
Button buttonStep = (Button)findViewById(R.id.button_Step);
buttonStep.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v1) {
// TODO Auto-generated method stub
/*Toast.makeText(ActivityForm5.this,
String.valueOf("CP_ID : " + CpID.toString()),
Toast.LENGTH_SHORT).show();*/
Intent newActivity = new Intent(ActivityForm5.this,ActivityForm7.class);
newActivity.putExtra("cp_id", CpID);
newActivity.putExtra("btn", "Step");
String permissionCode = getIntent().getStringExtra("permission_Code");
String sectionCode = getIntent().getStringExtra("section_Code");
newActivity.putExtra("permission_Code", permissionCode);
newActivity.putExtra("section_Code", sectionCode);
startActivity(newActivity);
}
});
Button buttonCp = (Button)findViewById(R.id.button_Cp);
buttonCp.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v1) {
// TODO Auto-generated method stub
/*Toast.makeText(ActivityForm5.this,
String.valueOf("CP_ID : " + CpID.toString()),
Toast.LENGTH_SHORT).show();*/
Intent newActivity = new Intent(ActivityForm5.this,ActivityForm6.class);
newActivity.putExtra("cp_id", CpID);
newActivity.putExtra("btn", "Detail");
String permissionCode = getIntent().getStringExtra("permission_Code");
String sectionCode = getIntent().getStringExtra("section_Code");
newActivity.putExtra("permission_Code", permissionCode);
newActivity.putExtra("section_Code", sectionCode);
startActivity(newActivity);
}
});
Button buttonIss = (Button)findViewById(R.id.button_Issue);
buttonIss.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v1) {
// TODO Auto-generated method stub
/*Toast.makeText(ActivityForm5.this,
String.valueOf("CP_ID : " + CpID.toString()),
Toast.LENGTH_SHORT).show();*/
Intent newActivity = new Intent(ActivityForm5.this,ActivityForm6.class);
newActivity.putExtra("cp_id", CpID);
newActivity.putExtra("btn", "Issue");
String permissionCode = getIntent().getStringExtra("permission_Code");
String sectionCode = getIntent().getStringExtra("section_Code");
newActivity.putExtra("permission_Code", permissionCode);
newActivity.putExtra("section_Code", sectionCode);
startActivity(newActivity);
}
});
Button buttonFact = (Button)findViewById(R.id.button_Fact);
buttonFact.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v1) {
// TODO Auto-generated method stub
/*Toast.makeText(ActivityForm5.this,
String.valueOf("CP_ID : " + CpID.toString()),
Toast.LENGTH_SHORT).show();*/
Intent newActivity = new Intent(ActivityForm5.this,ActivityForm6.class);
newActivity.putExtra("cp_id", CpID);
newActivity.putExtra("btn", "Fact");
String permissionCode = getIntent().getStringExtra("permission_Code");
String sectionCode = getIntent().getStringExtra("section_Code");
newActivity.putExtra("permission_Code", permissionCode);
newActivity.putExtra("section_Code", sectionCode);
startActivity(newActivity);
}
});
Button buttonJudge= (Button)findViewById(R.id.button_Judge);
buttonJudge.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v1) {
// TODO Auto-generated method stub
/*Toast.makeText(ActivityForm5.this,
String.valueOf("CP_ID : " + CpID.toString()),
Toast.LENGTH_SHORT).show();*/
Intent newActivity = new Intent(ActivityForm5.this,ActivityForm6.class);
newActivity.putExtra("cp_id", CpID);
newActivity.putExtra("btn", "Judge");
String permissionCode = getIntent().getStringExtra("permission_Code");
String sectionCode = getIntent().getStringExtra("section_Code");
newActivity.putExtra("permission_Code", permissionCode);
newActivity.putExtra("section_Code", sectionCode);
startActivity(newActivity);
}
});
}catch (Exception e)
{
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_test, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.menu_complain:
Intent i = new Intent(ActivityForm5.this, ActivityForm2.class);
String permissionCode = getIntent().getStringExtra("permission_Code");
if (permissionCode.matches("0"))
{
String sectionCode = "";
i.putExtra("section_Code", sectionCode);
}
else
{
String sectionCode = getIntent().getStringExtra("section_Code");
i.putExtra("section_Code", sectionCode);
}
String userId = getIntent().getStringExtra("user_Id");
i.putExtra("permission_Code", permissionCode);
i.putExtra("user_Id", userId);
startActivity(i);
return true;
case R.id.menu_search:
//System.out.println("ADD SYMBOL CLICKED!");
/*Intent myIntent2 = new Intent(this, ActivityFormSearch.class);
startActivityForResult(myIntent2, 0);
return true;*/
Intent i2 = new Intent(ActivityForm5.this, ActivityFormSearch.class);
startActivity(i2);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
你试过调试吗?错误是什么?我没有遇到错误。如果您想在AVD上运行,我可以发送我的项目。不显示数据并记录cat show W/OpenGLRenderer:未能在表面0xa6934360上设置EGL_SWAP_行为,错误=EGL_成功请尝试调试。然后您就可以取消它被卡住的位置。在Genymotion的第行:table=(SoapObject)responseBody.getProperty(0);具有get value,但在AVD上没有get value。