以下是应用崩溃的主要活动 我必须在微调器中选择状态,结果我得到城市列表,但它没有显示城市列表。如果我改变状态,那么仍然没有发生任何事情。 我正在研究android api 15。 如果我在api 8或10上工作,那么它可以正常工作。
String url="RegisterShop";
try
{
BufferedReader br=Mycon.getReader(url);
String str=br.readLine();
id1=Integer.parseInt(str);
nm.requestFocus();
Log.e("",""+id1);
}catch (Exception e) {
// TODO: handle exception
}
new Thread(new Runnable() {
public void run() {
try
{
BufferedReader br=Mycon.getReader("GetState");
String str1=br.readLine();
String st[]=new String[]{"Select State"};
Log.e("",""+st);
while(true)
{
if(str1==null)break;
st=str1.split(",");
Log.e("",""+str1);
str1=br.readLine();
}
ArrayAdapter<String>adapter=new ArrayAdapter<String>(Activity_Advertiser_Register.this,android.R.layout.simple_spinner_item,st);
state.setAdapter(adapter);
}catch (Exception e) {
// TODO: handle exception
}
state.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
s1=(String) state.getSelectedItem();
//Toast.makeText(RegisterActivity.this,""+s1,Toast.LENGTH_LONG).show();
try
{
BufferedReader br=Mycon.getReader("GetCity?state1="+s1);
String str1=br.readLine();
String ct[]=null;
while(true)
{
if(str1==null)break;
ct=str1.split(",");
Log.e("",""+str1);
str1=br.readLine();
}
if(ct.equals(null))
{
}
adapter=new ArrayAdapter<String>(Activity_Advertiser_Register.this,android.R.layout.simple_spinner_item,ct);
city.setAdapter(adapter);
}catch (Exception e) {
// TODO: handle exception
}
}
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
}}).start();
SellerSignUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
new Thread(new Runnable() {
public void run() {
if(nm.getText().toString().length()==0){
nm.setError("Please Enter Name");
}
if(pass.getText().toString().length()==0){
pass.setError("Please Enter Password");
}
if(address.getText().toString().length()==0){
address.setError("Please Enter Address");
}
if(contact.getText().toString().length()==0){
contact.setError("Please Enter Contact");
}
if(email.getText().toString().length()==0){
email.setError("Please Enter Email");
}
if(legalName.getText().toString().length()==0){
legalName.setError("Please Enter Person Name");
}
if(tin.getText().toString().length()==0){
tin.setError("Please Enter Tin Number");
}
String nm1=nm.getText().toString();
String pass1=pass.getText().toString();
String address1=address.getText().toString();
String contact1=contact.getText().toString();
String tin1=contact.getText().toString();
String email1=email.getText().toString();
String city1=(String) city.getSelectedItem();
String cp=legalName.getText().toString();
Random r=new Random();
String otp=new String();
for(int i=0 ; i<6 ; i++) {
otp += r.nextInt(10);
}
if(contact1.length()!=10)
{
contact.setError("Plese Enter 10 Digit");
}
if(tin.length()!=11)
{
contact.setError("Plese Enter Correct Tin Number");
}
if(checkEmail(email1)){
//Toast.makeText(RegisterActivity.this,""+city1,Toast.LENGTH_SHORT).show();
String url3="RegSave?id="+id1+"&nm="+nm1+"&pass="+pass1+"&address="+address1+"&contact="+contact1+"&email="+email1+"&city="+city1+"&contactperson="+cp+"&tin="+tin1+"&otp="+otp;
try{
BufferedReader br=Mycon.getReader(url3);
String rec=br.readLine();
if(rec!=null){
Toast.makeText(Activity_Advertiser_Register.this,rec.toString(),Toast.LENGTH_SHORT).show();
in=new Intent(Activity_Advertiser_Register.this,Activity_Advertiser_Verification.class);
in.putExtra("user",nm1);
startActivity(in);
}
}catch (Exception e) {
e.printStackTrace();
}
}
else{
email.setError("Invalid Email");
}
}}).start();
}
});
这是logcat