Posts by viana • 27,141 points
761 posts
-
1
votes2
answers203
viewsA: Exit warning on Webview
You can create the one AlertDialog defining the setPositiveButton() and setNegativeButton() within the method onBackPressed() in his Activity. Within the setPositiveButton() method you enter the…
-
5
votes3
answers1587
viewsQ: Redeem input file name and assign input text
I have the following code with a <input> text type and other file type. See: <form action="#" method="post" enctype="multipart/form-data"> Name file: <input type="text" name="name"…
-
20
votes1
answer7076
viewsQ: What’s the point of git push -u?
I’ve seen a lot of people asking questions about possible errors in GIT and noticed that sometimes it involves -u. For example Error in Android Studio 2.3 Integration with Gitlab and Error while…
-
7
votes1
answer500
viewsA: Refresh in Webview when rotating device
By default, when turning the phone the method onCreate is called again and with this, data that was dynamically loaded will be lost unless you do a treatment saving the state using the method…
-
0
votes1
answer163
viewsA: Scroll Webview does not appear
What’s going on is that your WebView is set not to have scroll. You have to remove the line android:scrollbars="none" of your *Webview *. See how it should look: <WebView…
-
0
votes0
answers23
viewsQ: Operations where the dividend value starts at 0
I have the following code: $value = 040; echo $value / 2; Exit: 16 The variable $valueand receives 040 instead of simply 40. However, in some languages, perhaps most, the 0 would be disregarded, in…
-
3
votes2
answers66
viewsQ: What is the purpose of & in PHP?
I have the following code snippet: $a = '1'; $b = &$a; $b = "2$b"; echo $a.", ".$b; Exit: 21, 21 I realized that there is no assignment to the variable $a other than the fact that $b = &$a…
-
27
votes1
answer455
viewsQ: What does the "+" sign in front of the function mean in Javascript?
Researching a little about form validation on Bootstrap, found the bootstrap-Validator, in which exactly in the file Validator.js, as you can see, it has the notation +funcion. Observe the code…
-
4
votes1
answer1330
viewsA: Structure MVP Android
There is much discussion about what would be the ideal way to implement the standard Model View Presenter in the Android. Since there is no "correct" formula, it will be up to you which path to…
-
9
votes4
answers8192
viewsQ: How to exclude an item from an array by the attribute value?
I got the following array with a few items: var arr = [ {id: 1, name: "Jon Snow"}, {id: 2, name: "Michael Scolfield"}, {id: 3, name: "Dexter Morgan"} ]; To add new item the method is used push.…
javascriptasked viana 27,141 -
2
votes1
answer213
viewsA: Programmatically insert dividing line
For example, to insert into a LinearLayout, first need instance it: LinearLayout linear = (LinearLayout)findViewById(R.id.linearLayout); Then just create a View programmatically this way below,…
-
1
votes1
answer154
viewsA: Application closes when I try to log in without filling in the fields
At first just do a validation to check if it has characters typed in the fields name and password. Example: Name = name.getText().toString(); Password = password.getText().toString();…
-
12
votes3
answers5013
viewsA: What is the difference between using Object.toString() and String.valueOf()?
In the documentation says that "if the argument is null is returned null, otherwise the value returns .toString". According to this tragic, the String.valueOf(Object) prints null as long as the…
-
0
votes1
answer241
viewsA: How to share audio from raw internal directory?
A way, among others, to do this, is to save the file first on the device before sending. See a simple method: public Uri shareItemRaw(int songInRawId, String songOutFile) { File dest =…
-
0
votes1
answer538
viewsA: Set specific time in Alarmmanager by Timepicker and Datepicker
[...]the notification already displayed right after... That’s because you’re actually setting it to be displayed right away. To click on botaoAgendar, you are passing the current time by using…
-
1
votes2
answers362
viewsA: Count golang number size
For the first case use the method strconv.Itoa() to convert the numeric value to string and the method len() to check the size of it. For the second situation, use rune(str)[position] in which,…
-
0
votes1
answer53
viewsA: Validation via web service
You can simply return a JSON using the echo with a specific message. Example: } else { echo "{\"message\": \"Ja existe um usuario cadastrado com este email\"}"; } This way, you just do the treatment…
-
2
votes2
answers60
viewsQ: How to sort object vectors by checking an attribute?
I can sort a simple list using the method sort Behold: var distances = [15, 18, 27, 29, 5, 3] distances.sort(function(a, b){ return a-b; }); console.log(distances); But I would like to sort a list…
javascriptasked viana 27,141 -
2
votes2
answers1054
viewsA: How to hide the keyboard when clicking an Edittext?
Use the method setOnTouchListener may be a solution. See: edt_dtnasc.setOnTouchListener(new View.OnTouchListener(){ @Override public boolean onTouch(View v, MotionEvent event) {…
-
2
votes1
answer173
viewsA: Update widget data - update time
To solution found of AlarmManager not to be ignored. The benefits of this approach is the possibility to configure the update time, and also handle the device case "sleep". But one has to wonder if…
-
0
votes1
answer49
viewsA: Have more options in action_send dialog
The most direct and common use of ACTION_SEND is to send text content from one activity to another. For example, the application can share a page URL currently displayed as text with any other…
-
0
votes2
answers53
viewsA: How is it possible to condition or check an item in a listview?
If you want to know which item the user clicked on, just use the position referring to the click on your vector strings. Behold: lista.setOnItemClickListener(new OnItemClickListener() { @Override…
-
2
votes3
answers6177
viewsA: Date Mask in Edittext
Basically Android does not offer a native class for this type of action, so it is possible to do this using a combination of numbers and special characters. There are some libs that can do this,…
-
4
votes1
answer253
viewsQ: Does AJAX requests work on Webview?
I got the following WebView: WebView myWebView = (WebView) findViewById(R.id.webview); myWebView.getSettings().setJavaScriptEnabled(true); myWebView.getSettings().setBuiltInZoomControls(true);…
-
5
votes1
answer5183
viewsQ: How to disable click out of modal?
I have a modal where I use to view the Google Maps Map. See the code below: <div class="modal fade" id="myMapModal" > <div class="modal-dialog modal-lg"> <div…
bootstrap-3asked viana 27,141 -
3
votes2
answers95
viewsQ: What is the numerical type builtins about?
I read in the book Python for Developers: Approaches Python 3.3 the following excerpt: In addition to the numeric type builtins of the interpreter, in the library Python standard there are several…
-
5
votes1
answer485
viewsQ: What are the advantages and disadvantages of using <? instead of <?php?
According to the PHP documentation it is possible to enable the short_open_tag in the archive php.ini, in which it is possible to use: <? /* jon snow */ ?> in place of: <?php /* jon snow */…
-
0
votes2
answers825
viewsQ: How to redeem checkbox value in the form using serialize()?
I have a form in which it is created dynamically using the method append. The result is something in this format: $('#form').append("<tr><td class='td-min'><input…
-
0
votes3
answers4208
viewsA: Random Numbers in Android Studio
There are several ways to do this, and one option is to use the method shuffle of Collections. See the steps: First you create an integer vector of size 60. Fills every vector with positions from 0…
-
2
votes2
answers1578
viewsQ: How to go back to the previous page when clicking Esc?
I have an item list on which when clicking on any item, and directed to another page for item details. I would like to click on the button ESC keyboard, back to previous page. Basically make the…
javascriptasked viana 27,141 -
0
votes1
answer61
viewsQ: How to remove increment from Kmllayers in Google Maps?
I have a list of items (in the code below two buttons) in which click on each one and open a modal with a map with its given KML. When it is clicked on the first item, the polygon of the item…
-
2
votes1
answer45
viewsQ: How to remove point altitude in a Poligono?
Below is a representation of a Polygon in a KML. See: <coordinates> -112.2550785337791,36.07954952145647,20 -112.2549277039738,36.08117083492122,20 -112.2552505069063,36.08260761307279,20…
-
1
votes1
answer45
viewsA: Using Media in Android Studio
You need only the class Mediaplayer and use the method start() to initialize. See: MediaPlayer mPlayer; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);…
-
2
votes1
answer177
viewsQ: How do you pause Chronometer and pick up where you left off?
On Android has the view Chronometer, automatically initializes when you enter the ativity. To reset the timer from the 0 use the following code: chronometer.setBase(SystemClock.elapsedRealtime());…
-
2
votes1
answer435
viewsQ: How to show an image in the Marker information window?
By clicking on a marker created with the Google Maps API, you can add an information window, which is what the code below does: google.maps.event.addListener(marker, 'click', (function(marker, i) {…
-
1
votes1
answer797
viewsQ: How to redeem external IP address on Android?
The address IPV4 local is not something very complex to rescue, can do this using the class NetworkInterface. But beyond the site, there is also the External IP, in which I realized that some people…
-
1
votes2
answers145
viewsA: I am unable to list my Sqlite data
There is an error in query sqlCreateTableInformation. The column TotalFinal does not have a specific type. Check and set a type for this column, if {INTEGER, TEXT, BOOLEAN, DOUBLE, ETC. } Here’s an…
-
0
votes2
answers939
viewsA: Android - Invalid Resource Directory Name
The error says: Invalid resource directory name You have created a directory, layout-tuto, inside of another directory, layouts, which is not recognized by the Android SDK, finally, soon the error…
-
5
votes1
answer585
viewsQ: Enable GPS within the app
Currently to check if the GPS is enabled use the following code: public boolean checkSetting(){ LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); return…
-
1
votes0
answers130
viewsQ: Error: Content-Length and stream length disagree
If you use a Log thus rescuing the body of the sponse: Log.wtf(TAG,""+response.body().string()); Correctly prints the JSON value. Something in this format: {"error":true,"message":"Login failed.…
-
1
votes1
answer25
viewsA: How to put Interstitialad in the app?
Full screen ads, called Interstitial ads covers the entire application screen, as a mode Fullscreen. See below as indicated and described in own documentation: First an Interstitial object must be…
-
3
votes1
answer229
viewsQ: Ipv4 and/or IPV6 record in the database
The Internet works through protocols like Ipv4 and Ipv6, possessing 32 bits and 128bits, which are numerical combinations that establish connections between computers. I have a device table,…
-
1
votes1
answer2083
viewsA: Remove spaces and special characters from a string
You can at first solve this problem by creating a method that receives a string as input and return the sentence without the accented characters. First you need to use the method normalize() to…
-
1
votes1
answer135
viewsA: How do I make the app icon appear in the action bar?
Use the method setDisplayShowHomeEnabled() to view the home button space: getSupportActionBar().setDisplayShowHomeEnabled(true); Then the method setIcon() to set the icon you want to view:…
-
3
votes2
answers1526
viewsQ: How to remove a character that is not a letter in a string?
I have a array of strings who returns to me as follows: Array ( [0] => motivação, [1] => sentimento33 [2] => que.. [3] => 56nos [4] => impulsiona\\ [5] => proporciona [6] =>…
-
3
votes2
answers2415
viewsA: How to get your Android device ID with Telephonymanager#getDeviceId()?
The getDeviceId() returns only value when the device is considering a phone. If you want to get a "unique" identifier from the device you can use Secure.ANDROID_ID. Take an example: import…
-
1
votes1
answer168
viewsA: How to return to the top of an Activity?
You can, by clicking the button with onClick, use the method scrollToPositionWithOffset class LinearLayoutManager, passing as parameter the position 0,0. Behold:…
-
5
votes1
answer1210
viewsQ: Test effective internet connection
I have an app where I do a connection test before consulting a webservice, just to display a message to user who has no internet connection. I use a method this way: public static boolean…
-
3
votes1
answer3816
viewsA: How to make a query in Sqlite?
To read from a database use the method query() passing the selection criteria and the desired columns. The results of the query are returned in an object Cursor. To see a line on the cursor, use one…
-
0
votes1
answer346
viewsA: Button that when clicking and holding it has a sharing function
To place an event while holding the button, just use the OnLongClickListener as you quoted @Luc in the comment. See how it can be done sehloiro.setOnLongClickListener(new View.OnLongClickListener()…