[Solved] What’s wrong in this code for firebase database? [closed]

You need to change this line of code: mDatabaseReference.child(“drivers”).child(userid).toString() != userid || mDatabaseReference.child(“parents”).child(userid).toString() != useremail) { with mDatabaseReference.child(“drivers”).child(userid).getRef().toString() != userid || mDatabaseReference.child(“parents”).getRef().child(userid).toString() != useremail) { As you probably see, i have added the getRef() method to actually get the reference. Hope it helps. 7 solved What’s wrong in this code for firebase database? [closed]

[Solved] Listener doesn’t work..It seems the Listener is 0

Extension of my comment above: You need to register the mListener somehow. A pattern to do this is: public class MyHandler { private LoginListener mListener; public MyHandler(LoginListener listener) { mListener = listener; } // … etc… } Where LoginListener is: public interface LoginListener { public void onLoginSuccess(); } And your activity has: public MyActivity implements … Read more

[Solved] How to set specific time in Toast?

What you can do i use Calendar class to get the current time. Check the time and display the toast accordingly. Calendar currentTime = Calender.getInstance(); int hour = currentTime.get(Calendar.HOUR_OF_DAY); if(Use your condition here) { Display toast } else if(Use your other condition) { Display toast } Just a note, your hour would be in 24 … Read more

[Solved] How to use 1 setter for multiple instance variables

I would suggest to make an int array to store your variables, so instead of: private int qz1, qz2,…. do private int [] quizValues; You can then get a value for a quiz: public int getQuizValue(int storePositionOfQuiz) { // check for outOfBounds! return this.quizValues[storePositionOfQuiz]; } If you want you can then initialize the quiz values … Read more

[Solved] How to create a switch for a takeDamage method

If I understood your question correctly, you want something like this: public void takeDamage(int damage){ shield-=damage; if(shield < 0){ health+=shield; //shield is negative,so subtracts leftover damage from health if(health <= 0){ lives–; health=DEFAULT_HEALTH_VALUE; //replace with your own default values shield=DEFAULT_SHIELD_VALUE; } } } 0 solved How to create a switch for a takeDamage method

[Solved] for each nested for each

You shouldn’t use nested for-each loops here. Try an indexed for on the listMain and store the result of each iteration in a kind of tuple. This tuple could be stored in a Map. As your friend mentioned, you could use a HashMap for this. Something like this should do the trick: ArrayList<Main>listMain = mainDAO.getlAllMain(Connection … Read more

[Solved] How can I get the sum, difference, quotient, product of two values and printed out in textview [closed]

add two EditText for getting two numbers then add four button for different operation like add/sub/mul/div. Get value of editText and Set onClickListener and write appropriate code in that. EditText firstNumber; EditText secondNumber; TextView addResult; Button btnAdd; double num1,num2,sum; firstNumber = (EditText)findViewById(R.id.txtNumber1); secondNumber = (EditText)findViewById(R.id.txtNumber2); addResult = (TextView)findViewById(R.id.txtResult); btnAdd = (Button)findViewById(R.id.btnAdd); btnAdd.setOnClickListener(new OnClickListener() { public … Read more

[Solved] I only created a blank activity and the app keeps crashing. The logcat shows several FATAL EXCEPTIONS

@ Stephanie-JK when you create a new project i think you have select a BASE Activity hence arrive this problem. Next time when you create a new project please select a Empty Activity then its generate a only one Layout and your problem resolve..thanks 9 solved I only created a blank activity and the app … Read more

[Solved] java.util.ArrayList cannot be cast to an object [closed]

Please look into stacktrace to see exact line where the problem occurs. First line of stacktrace should point you exactly to root cause. You may update sample code with that line, or update question with relevant part of stacktrace. Somebody is just casting ObjectXYZ to ArrayList, it seems. Also, do not return null from method … Read more

[Solved] How to solve java.lang.NoClassDefFoundError? Selenium

The error says it all : java.lang.NoClassDefFoundError: com/google/common/base/Function at MainTest.openGoogle(MainTest.java:15) While working with Selenium v3.x you have to download geckodriver.exe from mozilla/geckodriver and place it in your system. Next you have to set the system property through the line System.setProperty() as follows and provide the absolute path of the GeckoDriver binary within your system as … Read more