Lekropasky's Posts
Nairaland Forum › Lekropasky's Profile › Lekropasky's Posts
Am sorry for replying this late. Ok...to the real business. I can see some error here, you are already overriding the input entered by the user inside your switch statement. int day = input.nextInt(); //loop indefinitelly while(true){ //put your switch statement here. Switch(day){ case 0: System.out.print("The day is Sunday" ;break; //test other cases here.... default: System.out.print("you haven't entered a correct value. Please Try again" ;} //then, outside your switch statement, put this, day = input.nextInt(); //to break of this loop, simply put a condition here...e.g, if you want to break when the user enter 9. if(day==9){ System.out.print("Thank You for using this program" ;break; } } |
I have an idea...this is the largest forum in Africa, i think we can use this opportunity to get it published. Lets see if developers on this forum will turn up. Ok, ill say more when i reach home.... |
hollyfat:Thanks Bro. |
I am typically an Android Developer, but recently I have a very important web project i am working on, and since two weeks ago i have been working on the backend(PHP), on Sunday(this week) i started working more on the frontend and Yes!--this is where i have the problem, although i am using bootstrap, yet i still can't find the design to be very sweet as i have imagined it to be. Can anyone please tell me where i can get an editable template(The website is more of social networks) because right now i really need to finish the project ASAP. Please Help... Thanks. |
privatetisa:07035452307 |
naxman:07035452307 |
cshortz:ALLRight, GoodLuck Bro.. |
nene2016:Thanks Bro.... |
This is quite Long. I dont really get what your are trying to do, but i can guess this is what you are trying to do. Like in quiz System, you want users to see Diffrent questions everytime the press 'Next' or whatever button you link the event with...Ok. if thats what you are trying to do, try this. Java is an OOP, so you can create a POJO( Plain Old Java Object) class, which will represent each equation...Like this---> public class Equation{ //Create the class property/fields public int variableA; public int variableB; public int variableC; public char operator; public int answer; //create a constructor, remember this will be automatically called when the object is created //Remember the uses of 'this' keyword to make refrence to the member of current class... public Equation(int varA, int varB, int varC, char op, int ans ) { this.variableA = varA; this.variableB = varB; this.variableC = varC; this.operator = op; this.answer = ans; } //now, create the getters and setters public void setVariableA(int v_A ){ this.variableA = v_A; } public void setVariableB(int v_B ){ this.variableB = v_B; } public void setVariableC(int v_C ){ this.variableC = v_C; } public void setOperator(int op ){ this.operator = op; } public void setAnswer(int ans ){ this.answer = ans; } public int getVariableA(){ return this.variableA; } public int getVariableB(){ return this.variableB; } public int getVariableC(){ return this.variableC; } public char getOperator(){ return this.operator; } public int getAnswer(){ return this.answer; } //voila, this will make things easy public String getQuestion(){ //form a question String. so, that it"ll be very easy to call later... String question = getVariableA() + "x " + getOperator() + " "+getVariableB() + " = " + getVariableC(); return question; } } Then Create an activity that serves as your Question/Quiz activity... class QuizActivity extends Activity{ //create a list that"ll hold your equations List<Equation> equationList = new ArrayList<>(); TextView equationTextView; //create a random object to generate random numbers Random randomNumber = new Random(); //lets say you bind the event to a Button Button nextEquation; protected void onCreate(Bundle instance ) { //get textView equationTextView = (TextView) findViewById(R.id.textview); nextEquation = (Button) findViewById(R.id.nextButton); //add equations to the list... //remember equationList takes an Equation object as the List elements equationList.add( new Equation(1,2,3,"-",5)); equationList.add( new Equation(1,4,0,"-",4)); equationList.add( new Equation(1,5,3,"-",1)); equationList.add( new Equation(1,9,3,"-",2)); equationList.add( new Equation(1,2,1,"-",1)); nextEquation.setOnClickListener(new View.setOnClickListener(){ public void onClick(View view){ //shuffle the List, generate any number between 0 and 5 int currentIndex = randomNumber.nextInt(5); //now, the real shuffle.. //this will take the equation number 'currentIndex' from equationList and put it on the TextView. //Each time user click the 'next Button' a new random number will be generated which causes the equationList to return diffrent equation on each click Equation currentEquation = equationList.get(currentIndex); equationTextView.setText(currentEquation.getQuestion()); } }); } } Hope this helps...Feel free to ask questions. |
Hello Guys, i seriously want to know how profitable is it to monetize android Apps as i have no idea about it. Thanks... |
prinzfunchi:Allright bro |
prinzfunchi:Yeah... I think I have seen you before. |
yunglary:Wow... I really like this. I will seriously work on it next time. thanks bro |
Waleyisco:No problem, I love making new friends. |
yunglary:Is it impossible for me to build this ? |
I have a question puzzling my mind. The instagram native app has a 'follow button' which when clicked sends some request to server in an AJAX-like mode, i dont understand how this works, is there a way to implement AJax funtionality using Java and Android Sdk...Thanks |
prinzfunchi:WoW...so happy i met a ladokite here on Nairaland..Thanks. Can you add your pics? We might have met before... |
Hi Guys, this morning i was trying to boot into my HP laptop computer and i discovered that the keyboard and mouse are no longer responsive. Note that, keyboard works before the windows splash screen shows up and immediatly stop working after the start up, i dont know what to do. Please help. |
Hi guys, I am thinking there should be a way to get the raw JSON format of JAMB past questions. Have you ever seen or heard about that before? |
Thanks You'll. I dont have any knowledge about node.js, i'll prefer PHP. |
nice post.... |
hi bro, can you give me a head up about how this chating stuffs in android. I have google a lot I haven't found a solution. the only thing I have seen so far is this XMPP stuffs. I'll be happy if you can put me through. thanks |
dhtml18:OK Bro |
FrankLampard:Try and connect your phone and laptop to the same network. E.g, turn on your phone mobile Data and Hotspott and connect to the hotspot with your laptop. It should work that way... |
FrankLampard:Get your laptop IP address By this-> cmd -> ipconfig. Next, Click on WAMP icon on the window TaskBar and Click on "put online" inside the menu popup... After that, you can access your URL like this from anywhere......http://your.ip.adress/YourRootFolder/script.php... |
dhtml18:the library is great. what I like most about it is the easy way of sending FILES to http server using the RequestParams class.... |
Hi Gurus. Recently i am carrying out a research on how users can pay for a paricular services on the internet using the credit on their mobile phones. If you can try to remember, 2go uses such services to charge user for GoCredit, i want someone that knows or have any idea about this to tell me how it works. Thanks... |
FrankLampard:I dont think theres any need to use a Framework for this kinda task, though, i am not a PHP guy, but simple PHP script that can talk to database and echo a JSON String is all you need to write. Example...for registration: <?php $host = 'localhost'; $user = 'root'; $pass = ' '; $connection = mysql_connect($host, $user, $pass); mysql_select_db( 'db name'); //user data $username = $_POST['user']; $mail = $_POST['email']; $password = $_POST['password']; $json = array(); $query = Insert into users( username, email, password) Values( '$username','$mail','$password') $result = mysql_query($query); if($result){ array_push($json, array('success'=>true, 'fail'= >false)) }else{ array_push($json, array('success'=>false, 'fail'= >true)) } mysql_close($connection); echo json_encode($json);?> |
I finally found a library called android-async-http, i think the library is OK because the popular Instagram uses the Library...Thanks Bro @dhtml18 |
Thanks Bro. The reason why i dont wanna use base64 encoding is because it causes OutOfMemory Exception in low memory devices when i tried to upload more than one image with size larger than 800KB, so am trying to get a very effective way, say i want to upload maybe a video file of about 10MB, base64 encoding cannot work for that....Thanks for these links. I'll check it. |
Hello Guys, Please i need help on simple script to upload Picture to PHP server from android. I dont like to use base64 encoding as its not really effective. Thanks you'll |
;