Posts by viana • 27,141 points
761 posts
-
3
votes1
answer571
viewsA: How to know which Activity is open, running?
One way to do this is to create a static variable and change it according to the life cycle of the Activity. For example, when the method onStart() execute the received variable true. If the…
-
2
votes3
answers304
viewsQ: What is the difference between the modules Math and cmath?
In Python we realize that there are the following modules: math and cmath, however I did not understand what difference between the two. See how they can be imported: import math import cmath What…
-
3
votes1
answer253
viewsA: How to assign rounding on the button and random colors at the same time?
You can set the border programmatically using shape.setStroke(3, borderColor), where the 3 represents the edge and borderColor represents the color of the border using the GradientDrawable. See this…
-
1
votes3
answers248
viewsA: How to make an Array created within an Asynctask be global?
A simple solution to get the value clicked on your Spinner is to create a variable in your out class PostConfirmationActivity. For example String selectedName, which apparently is already created,…
-
1
votes2
answers877
viewsA: Textview is not displaying decimal numbers of a long type variable!
You can use the Decimalformat, or do so below, in which 2f means you want 2 houses after the comma. See: String.format("%.2f", number); Adapting long valor = n01 /n02;…
-
2
votes2
answers212
viewsA: When I delete the last Edittext character from the PARA app, what to do?
To solve this problem, a possible solution is to create a condition to compare the size of the CharSequence and perform any procedure if it is greater than 0. Behold: if (s.length() > 0) { //…
-
2
votes2
answers106
viewsA: What method to make you download all the media volume on Android?
You must use the Audiomanager, which is a public class, which provides volume access and control of bell mode. See an example below of how it can be used by defining, with the method…
-
3
votes2
answers3011
viewsA: Write to.txt file
First you have to give permission to read and write on your AndroidManifest.xml. Behold: <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission…
-
1
votes2
answers555
viewsA: Barcodedetector does not detect barcode and camera does not focus (I have already put the permissions in the manifest)
The class responsible for setting focus on your camera is the Camera on which you have the call Camera.Parameters that has some important constants for configuration. See below:…
-
20
votes2
answers5648
viewsQ: What is Ecmascript 2015 (ES6) specification?
I recently started a project with Cordova + Ionic and, at a certain point, I entered an impasse in which I found the affirmative that the framework follows the "latest" web standards such as the new…
-
2
votes1
answer216
viewsA: How to popular a Spinner from data returned from a URL?
Instead of setting your list as a model <JSONObject>, you will switch to String, which in this case would be a list of strings. List<String> categories = new ArrayList<>(); Just…
-
3
votes1
answer199
viewsA: How do I get the listview style effect?
To remove the "stripe" from your ListView just you set the divider as @null. See below: <ListView android:id="@+id/list" android:orientation="vertical" android:layout_width="match_parent"…
-
3
votes1
answer3178
viewsA: "What eh"/"how to resolve" a "null Object Reference" error? What appears on the console?
Briefly the exception Nullpointerexception is launched whenever you try to access a memory object that has not been instantiated, or better initialized, until the moment of your call. First factor…
-
1
votes1
answer241
viewsA: How to modify zxing default screen
You can use the Barcode API of Mobile Vision which is from Google itself. If you feel bothered that people will feel uncomfortable, you can take a closer look at the documentation and make the…
-
0
votes2
answers138
viewsA: Googleapiclient in Fragments
How do I use this inside a Fragment? Just follow the changes below. In the Fragment you will just change where you have this for getActivity(). Another change will be in your views, because instead…
-
0
votes1
answer143
viewsA: Error using Long.parseLong to capture Edittext value for a LONG variable
If you choose not to use a button to redeem the values only after clicking, you can use the addTextChangeListener(). This way, in the media that adds the value in Edittext, it will already assign to…
-
31
votes2
answers5048
viewsQ: What is a context-free language?
In Wikipedia has the following statement: In formal language theory, a context-free language (LLC) is a language generated by some context-free grammar (GLC). Different context-free grammars can…
-
12
votes3
answers572
viewsA: What is a devops?
Devops acronym for Development and Operations, which would be in Portuguese Desinvolvement of OpErações has as idealization the continuous integration, agility, quality, stability with scalability…
-
0
votes1
answer145
viewsQ: Cordova + Ionic installation error using Node.js
In the attempt to install Cordova + Ionic using Node.js, the following error is occurring: npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program…
-
2
votes4
answers148
viewsA: Background of Imagebuttons
Basically you need to put the background a second button on the button clicked. Having this and using the setOnClickListener() the code below rescues the background using the method getBackground()…
-
11
votes6
answers422
viewsA: How to "call" this correctly?
The first factor to note in this situation is that to call the method setOnItemSelectedListener() requires the implementation of the interfaceAdapterView.onItemSelectedListener in the class. An…
-
4
votes1
answer148
viewsA: How to send Json to another Activity?
You can simply put JSON on one String and send it using the method putExtras() in this way: Intent intent = new Intent(this, DestinoActivity.class); intent.putExtra("json", jsonobj.toString());…
-
2
votes1
answer514
viewsA: I can’t get a Textview to display the content in an Edittext!
One way to do this is to use the method addTextChangeListener(). Just below your conditions, add the code below: etNome.addTextChangedListener(new TextWatcher() { @Override public void…
-
1
votes1
answer2181
viewsA: Unable to find the wrapper "https" - Did you Forget to enable it when you configured PHP?
Go to your file php.ini and check if the extension php_openssl.dll is like a ; (point and comma) in front. Ai you can insert this way: extension = php_openssl.dll Once done, restart Apache and try…
-
1
votes1
answer55
viewsA: Comparison __FILE__ and $0
In the ruby-lang.org has a good explanation of what/why. See: __ FILE__ is the magic variable that contains the current file name. $0 is the name of the file used to start the program. Basically it…
-
2
votes2
answers117
viewsA: How to identify the click on a drawableLeft
I did some tests here and it worked great for the DawableLeft. The proposed calculation is to verify that the coordinate of the clicked event is less than or equal to the size of the left space plus…
-
0
votes1
answer817
viewsQ: How do I change the class of a button according to its id and value?
I intend to modify the class of a button according to its id and its value. Each <button> has equal identifiers, but different values. I tried this way below, however only the first button is…
-
8
votes3
answers813
viewsQ: What is the difference between methods for obtaining a context?
One can, beyond the this, get the context in several ways, with different methods. As shown in the code below, we have the getApplicationContext() and the getBaseContext() which apparently serves…
-
0
votes1
answer110
viewsA: How to create a standard typing format in an Android Studio form?
An alternative to solve this is to create a validation methods using android.util.Patterns.EMAIL_ADDRESS. See how it would look: public static boolean validEmail(CharSequence str) { return str !=…
-
3
votes1
answer2410
viewsA: How to catch a JSON from a URL?
android.os.Networkonmainthreadexception The exception that is thrown when an application tries to run a network operation in its core segment. To avoid this error, try using the AsyncTask. And put…
-
1
votes3
answers664
viewsQ: How to convert a numeric value to Boolean?
I get a value boolean of the database, in which I intend to define a checkbox dynamically. The value received is 0 or 1. I tried to do it this way below: var status = 1; //valor recebido…
-
2
votes1
answer197
viewsA: Remove . php extension except from a file
This way can solve for you. See: # index.php > index (visível, exceto para index.php) RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/(.+)\.php[^\s]* [NC] RewriteCond %{REQUEST_FILENAME} !index\.php…
-
5
votes2
answers1746
viewsQ: How do you count the number of times a word repeats itself in a sentence?
I have a certain phrase declared in a variable. See: $bacco = "Você tem que abrir seu coração pro SQL e pedir o que realmente quer."; I can verify if there is a certain word inside the sentence…
-
4
votes3
answers21853
viewsQ: How to select an option in <select> via text using jQuery?
I have a <select> created in this way: <select id="animal"> <option value="0">Novilha</option> <option value="1">Bezerro</option> <option…
-
1
votes1
answer120
viewsQ: Redeem values from a modal item to update it in the database
I have some items returned from the bank that is listed in a table. To add an item, I call a modal where I fill in the fields by saving them in the database. However, if filling in this field is…
-
1
votes3
answers707
viewsA: Formatting dates for display and storage
What you have to note is that you are entering with a different format than you are using in SimpleDateFormat(). Basically you have to use two formats, one input and one output. For input in this…
-
9
votes2
answers1527
viewsQ: How to search for saved records in the current week?
I’m doing a database query, and I plan to list the records for the current week. It would be something based on the question about retrieve data from last 7 days from current date, but instead of…
-
4
votes2
answers987
viewsA: How to put a Popup that asks permission to use GPS?
You need to do two types of checks when it comes to GPS. The first is if your GPS is enabled and the second is if you are using API 23, you have to use Request for runtime permissions. Let’s go over…
-
0
votes2
answers242
viewsA: Filter in Google Places API
I believe William’s response to how Send address to search on Google Maps takes good care of you, but would need some details about the Types of venues Google Place allows for search. This page has…
-
0
votes2
answers4385
viewsA: How to set a Textview with a DOUBLE variable?
There are many ways you can do this: Form 1 String valueDouble= Double.toString(media1); txtMedia1.setText(valueDouble); Form 2 txtMedia1.setText(""+media1); Form 3…
-
0
votes1
answer3932
viewsA: Is there an API/Web Service that provides the names of existing cars?
It is difficult to find people or companies who really want to provide this information, however I know the Carquery which is an easy-to-use JSON-based API to retrieve detailed information from car…
-
2
votes1
answer547
viewsA: call requires api level 24 (Current min is 16): android.icu.text.Decimalformat#Decimalformat
According to the documentation, the android.icu.text.DecimalFormat#DecimalFormat is only available for API 24+ and will not work in your project unless you change the minSdkVersion to 24. Maybe you…
android-studioanswered viana 27,141 -
2
votes1
answer289
viewsA: I want to use Cardview to make the screen more beautiful only cardView works similar to a listview?
First, after the project is created, go to the file build.gradle (app) and add the following dependencies: compile ‘com.android.support:cardview-v7:21.0.+’ compile…
-
0
votes3
answers1438
viewsA: How to get value from selected checkbox
See this way, generating a link to search with $_GET $(document).ready(function(){ $("#test").click(function(){ var testval = []; $('.span3:checked').each(function() { testval.push($(this).val());…
-
3
votes2
answers120
viewsA: Error running mysql_query
Try to do this way in this connection order: DB_HOST, DB_NOME_USUARIO, DB_SENHA, DB_NOME_BANCO. Behold: $conn = new mysqli("localhost", "user", "senha", "bd"); // verifica se encontrou algum erro na…
-
3
votes2
answers1670
viewsA: How to update recyclerView after updating data via dialog
If you want to insert or remove items within the Adapter, you will need to explicitly inform you that there has been a change. This is slightly different from notifyDataSetChanged(). Just create two…
-
3
votes2
answers328
viewsQ: What would the query look like to return values in a given range?
I have a table with the following Rows: code (int) vaccine (varnish) dt_maturity (datetime) I need a query to return all vaccines that will win in the interval of 10 days, counting today’s date. I…
-
0
votes2
answers1306
viewsA: How to create view password option typed in form
See if it helps you this way: $(document).ready(function() { $("#showHide").click(function() { if ($(".password").attr("type") == "password") { $(".password").attr("type", "text"); } else {…
-
4
votes2
answers364
viewsA: How to create Checkbox via programming
To create CheckBox programmatically just do you this way: CheckBox meuCheckbox = new CheckBox(getApplicationContext()); meuCheckbox.setText("Programaticamente criado"); To check if it is enabled or…
-
1
votes1
answer1022
viewsA: Is it mandatory to publish the app in an official store to use Admob?
Your application is not required to be in the Google store for it to be monetized, however you have to sign your APK and do not distribute in debug mode. If you publish in debug mode, it is…