Actually Iam doing one of the app in that admin panel is there. Here whoever has been registered it has to come to admin panel and then when he approved then that person can able to signin. but I stucked at after I checked the box and then when I click on approve button it is showing nullpointerexception at check box. Please tell me suggestion
Button approve = (Button) findViewById(R.id.aprvbtn);
assert approve != null;
approve.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
for (int i = 0; i < retlist.getAdapter().getCount(); i++) {
final CheckBox check = (CheckBox)retlist.getChildAt(i).findViewById(R.id.check);
//
//
if (check.isChecked()) {
TextView user_name;
String username;
user_name = (TextView) retlist.getChildAt(i).findViewById(R.id.username);
username = user_name.getText().toString();
String APPROVE_URL = "http://ift.tt/1sBWRJb" + URLEncoder.encode(username);
HttpClient myclient=new DefaultHttpClient();
HttpPost post=new HttpPost(APPROVE_URL);
HttpResponse resp=null;
try{
resp=myclient.execute(post);
}catch (Exception e){}
if(resp!=null)
{Toast.makeText(AdminActivity.this,"Succesfully Approved!",Toast.LENGTH_SHORT).show();}
else{
Toast.makeText(AdminActivity.this,"Error in Approving!",Toast.LENGTH_SHORT).show();
}
}
}
}
}
);
}
Aucun commentaire:
Enregistrer un commentaire