[Solved] Open a new activity from a class string. Class null

[ad_1] When you use Class.forName(className) method, className has to be constructed from your package name and your Class name without the .class extension. For ro.movieapp.activities.MovieActivity.class your call should be something like this: Class.forName(“ro.movieapp.activities.MovieActivity”). That being said, it is a really bad idea to do it because it’s an easy source of bugs (your question is … Read more

[Solved] What exactly does Math.floor do?

[ad_1] No, in fact this line of code outputs 0: Math.floor(0.9); Math.floor always rounds to the nearest whole number that is smaller than your input. You might confuse it with Math.round, that rounds to nearest whole number. This is why this code always outputs 1 or 0, since input never gets to 2 or bigger: … Read more

[Solved] In plain C, without using strlen or any library function that uses strlen, how do you find whether one string is contained in another?

[ad_1] Removing the variable flag is deceptively easy by the way, as the only cases (using your algorithm as shown) where your function should return true is if either s1 is empty or the condition !*c is true. In all other cases it should return false. So your function, without any other modifications, could easily … Read more

[Solved] how to replace some character’s of String

[ad_1] You can use string replace method. see below String number = +9231235410; String newNumber = number.replace(“+92″,”0”); EDIT: this one is base on your code private String modifyNumber(String num) { if (num.startsWith(“+92”)) { num = num.replaceFirst(“\\+(92)”, “0”);} return num;} Note: In java, you need to have double backslash since the \ is a unique java … Read more

[Solved] Rearrange the autoincrement column value after deleting some rows

[ad_1] When you have declared the column as INTEGER PRIMARY KEY, you don’t need to do anything because the database automatically uses the next value after the largest value in the table. When you have declared the column as INTEGER PRIMARY KEY AUTOINCREMENT, the current counter is stored in the sqlite_sequence table. You can simply … Read more

[Solved] Issue with substr C++

[ad_1] As mentioned you can’t call substr() with a std::ifstream. What you probably meant was to take the parts from the line string read in a[i]= stoi(line.substr(4,2)); name[i]= line.substr(18,15); b[i]= stoi(line.substr(36,1)); Also note you’ll need to convert the substrings extracted to a number (instead of assigning them directly), hence I have added the stoi(). As … Read more

[Solved] Phonebook program doesn’t work in Java

[ad_1] This should fix both your issues.. I’ve made a number of changes to the code, so it will be difficult to explain everything, but I’ve included the main points after the code. Try going through it and add a comment in case of any doubt. import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import … Read more

[Solved] Javascript for a suggestion box that pops up as the user scrolls down the screen. [closed]

[ad_1] You don’t need a plugin. Try something like this jQuery: $(document).ready(function() { //Check to see if the window is top if not then display button $(window).scroll(function() { if ($(this).scrollTop() > 100) { $(‘.nextPost’).fadeIn(); } else { $(‘.nextPost’).fadeOut(); } }); }); .nextPost { background: lightgray; font-weight: bold; position: fixed; top: 5px; right: 5px; display: none; … Read more