Hi to all, I want to make progress bar visible on button click.It is happening properly but when progress bar start it hides the text of edit box.After the completion of process(also progress bar's visibility is gone) ,if user want to enter any data in edittext box it can done but it'll not be visible to the user.Can any one tell me solution. here is my code:-`public class Login extends Activity implements OnClickListener { /** Called when the activity is first created. */ EditText user_name; EditText user_pass; Button login_btn; ProgressBar bar; String response_get;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.login);
user_name = (EditText) findViewById(R.id.user_id_edit);
user_pass = (EditText) findViewById(R.id.user_pass_edit);
login_btn = (Button) findViewById(R.id.login);
bar = (ProgressBar) findViewById(R.id.splash_progressbar);
login_btn.setOnClickListener(this);
login_btn.setBackgroundDrawable(getResources().getDrawable(
R.drawable.login_selector));
}
public void onClick(View v) {
// TODO Auto-generated method stub
if (v.getId() == R.id.login) {
response_get = null;
if (user_name.getText().length() == 0
|| user_pass.getText().length() == 0) {
Toast.makeText(this, "Required field must not be blank ",
Toast.LENGTH_LONG).show();
} else {
bar.setVisibility(0);
if (Internet.checkConnection(HIVPharmacy.this)) {
new Thread() {
public void run() {
response_get = ImageUploader.getCLient(user_name
.getText().toString(), user_pass.getText()
.toString());
WebServices.abc(user_name.getText().toString(),
user_pass.getText().toString());
// Log.e("Ye Response mila hai ting tong",
// response_get);
handler.sendEmptyMessage(0);
handlerFinishProgressbar.sendEmptyMessage(0);
}
}.start();
} else {
new AlertDialog.Builder(Login.this)
.setTitle("Alert!").setMessage(
"Please check internet connetion.")
.setNeutralButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog,
int whichButton) {
finish();
android.os.Process
.killProcess(android.os.Process
.myPid());
}
}).setCancelable(false).create().show();
}
}
}
}
private Handler handlerFinishProgressbar = new Handler() {
@Override
public void handleMessage(Message msg) {
bar.setVisibility(8);
}
};
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
if (response_get.trim().contains("user")
&& response_get.trim().contains("admin")) {
new AlertDialog.Builder(Login.this)
.setTitle("Admin!")
.setMessage(
"Do you want to add new user or want to administer tests.")
.setPositiveButton("Add user",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int whichButton) {
startActivity(new Intent(
Login.this, Admin.class));
}
}).setNeutralButton("Administer test",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int whichButton) {
startActivity(new Intent(
Login.this,
ClientVerification.class));
}
})
.setCancelable(false).create().show();
user_name.setText("");
user_pass.setText("");
// bar.setVisibility(8);
Toast.makeText(getApplicationContext(), "Admin",
Toast.LENGTH_LONG).show();
} else if (response_get.trim().contains("user")) {
Toast.makeText(getApplicationContext(), "User",
Toast.LENGTH_LONG).show();
startActivity(new Intent(Login.this,
ClientVerification.class));
user_name.setText("");
user_pass.setText("");
// finish();
// bar.setVisibility(8);
} else {
Toast.makeText(getApplicationContext(),
"Invalid user name or password", Toast.LENGTH_LONG)
.show();
// bar.setVisibility(8);
}
}
};
}`
Here is XML file:-
'
<RelativeLayout android:id="@+id/bar"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:background="@drawable/bg2"
android:gravity="center">
<TextView android:id="@+id/topbar_txt" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_centerInParent="true"
android:gravity="center" android:text="User Login" android:textSize="20dip"
android:layout_marginBottom="10dip" />
</RelativeLayout>
<TableLayout android:id="@+id/table_layout_login_id_and_password"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:background="@drawable/hiv_login_bg"
android:layout_centerVertical="true" android:layout_weight="1">
<TableRow android:layout_marginTop="15dip"
android:layout_marginLeft="15dip">
<TextView android:id="@+id/user_id_txt"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_column="1" android:gravity="center_vertical|right"
android:text="@string/nurseId" android:layout_marginRight="5dip" />
<EditText android:id="@+id/user_id_edit"
android:layout_width="160dip" android:layout_height="wrap_content"
android:singleLine="true" />
</TableRow>
<TableRow android:layout_marginLeft="15dip">
<TextView android:id="@+id/user_pass_txt"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_column="1" android:layout_marginRight="5dip"
android:text="@string/nursePass" android:gravity="center_vertical|right" />
<EditText android:id="@+id/user_pass_edit"
android:layout_width="160dip" android:layout_height="wrap_content"
android:singleLine="true" android:password="true" />
</TableRow>
</TableLayout>
<RelativeLayout android:id="@+id/relative_radio_group_register"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_below="@id/table_layout_login_id_and_password">
<Button android:id="@+id/login" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_below="@+id/edit_pass_login"
android:layout_centerHorizontal="true" android:layout_marginTop="15dip"
android:gravity="center" android:background="@drawable/login_btn" />
</RelativeLayout>
<ProgressBar android:id="@+id/splash_progressbar"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" android:visibility="gone"
android:indeterminateDrawable="@drawable/progressbar" />
'
This code is working properly with "Nexus One" but creating problem with G1.