I've returned to old project of mine and slowly fixing things to make it work again. It was android 9-10 when i first started and now i changed it to 13-14. In my java class there is a template like 4 choices but when i click any of them nothing happens and i saw no errors in logcat (also when running) . I was using some clicklisteners and
ProgressDialog for these buttons (it was showing a text like "searching for players..." and then redirecting when it found from the firebase database) but i realised that progressDialog is depreceated. Can it be the reason why it doesnt response to clicks? if so how i can change my code to ProgressBar (i guess it is the alternative) to fix this issue
My code is like below:
I've returned to old project of mine and slowly fixing things to make it work again. It was android 9-10 when i first started and now i changed it to 13-14. In my java class there is a template like 4 choices but when i click any of them nothing happens and i saw no errors in logcat (also when running) . I was using some clicklisteners and ProgressDialog for these buttons (it was showing a text like "searching for players..." and then redirecting when it found from the firebase database) but i realised that progressDialog is depreceated. Can it be the reason why it doesnt response to clicks? if so how i can change my code to ProgressBar (i guess it is the alternative) to fix this issue My code is like below: [code]@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Context context = this; FirebaseUser firebaseuser = FirebaseAuth.getInstance().getCurrentUser(); uid = firebaseuser.getUid(); user = firebaseuser.getDisplayName(); mDatabase = FirebaseDatabase.getInstance().getReference().child("users").child(uid); mDatabase_status = FirebaseDatabase.getInstance().getReference().child("users").child(uid).child("status"); kullanici = new database(); kullanici.status(mDatabase,"off"); postListener = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if (dataSnapshot != null && dataSnapshot.getValue() != null) { win =String.valueOf(dataSnapshot.child("win").getValue()); if(win==null){ win="0"; } lose =String.valueOf(dataSnapshot.child("lose").getValue()); if(lose==null){ lose="0"; } TextView userinfo = (TextView) findViewById(R.id.kullanicibilgisi); String newstring = "Hoşgeldin "+user+"<br>Galibiyetler: "+win+"<br>"+"Yenilgiler: "+lose; userinfo.setText(Html.fromHtml(Html.fromHtml(newstring).toString())); } }
@Override public void onCancelled(DatabaseError databaseError) { Context context = getApplicationContext(); Toast.makeText(context, "Failed to load post.", Toast.LENGTH_SHORT).show(); } }; postListener_status = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if (dataSnapshot != null && dataSnapshot.getValue() != null) { String userstatus =String.valueOf(dataSnapshot.getValue()); if ("on".equals(userstatus)){ dialog.hide(); mDatabase.removeEventListener(postListener); mDatabase_status.removeEventListener(postListener_status); Intent intocan = new Intent(MainActivity.this, ikinciekren.class); startActivity(intocan); } } }