Posts by ramaral • 44,197 points
1,060 posts
-
2
votes2
answers1682
viewsA: Is it possible to have a round button without changing the android:background attribute?
Is there any way to avoid using the.xml background as the button background and just using the Button attributes could be performed the same change as your Shape? Not. A button, like any View, is a…
-
2
votes1
answer43
viewsA: Add Beforeclick and Afterclick events to a button
When a View is "clicked" the implementation of the View class calls the method onClick() implementation of the Onclicklistener interface, indicated by the method setOnClickListener(). As it is not…
-
4
votes2
answers118
viewsA: What is the difference between getRating() and getProgress()?
getProgress() should be using when using a Progressbar and getRating() when you use a Ratingbar. The same applies to setProgress() and setRating(). TL;DR getProgress() is a class method Progressbar…
-
1
votes1
answer74
viewsA: In android 8 Service stops and does not reboot when Activity ends
This has to do with the restrictions that Android 8 imposes, among others, on the use of services, when the application is in background. Restrictions aim to decrease battery consumption and improve…
-
3
votes1
answer115
viewsA: How to stop a service?
To stop the service call the stopService() method by passing you an Intent equal to the one you used to start it Intent intent = new Intent(this, DNSVpnService.class); stopService(intent);…
-
1
votes1
answer148
viewsA: Different layout for portrait(portraint) and landscape(Landscape)
You do not need to make such a check. Android system will automatically load the existing layout into folder land when the device is turned to orientation Landscape.
-
4
votes1
answer183
viewsA: Doubt with correct dpi(dp) density
No. The screen density(Screen Density)(dpi) does not limit the maximum value to be used in width & height(dp). A screen has two features: Screen size(Screen size) - Represents the actual…
-
3
votes1
answer112
viewsA: How to make a method wait for the java server response using Retrofit2?
Not(1), is not possible. The "calls" executed by Retrofit have the result returned asynchronously. The result is obtained in the method onResponse() or, in case of error, in the method onFailure(),…
-
0
votes2
answers66
viewsA: What permissions need to be requested at runtime?
Permissions that need to be requested at runtime are those considered as "dangerous"(Dangerous Permissions). Within the list he submitted, READ_CALENDAR and WRITE_CALENDAR are in the group of…
-
1
votes1
answer70
viewsA: Apply setItemOnClickListener to Gridview Buttons. Kotlin or Java
knowing that you can only trigger an Intent inside an Activity. This is not true. It is possible anywhere as long as you have a Context available. If you want to implement the Onclicklistener of…
-
6
votes2
answers594
viewsA: What is Java Sort?
I think you’re confusing the terms "ordered" and "Sorted". The Array represents a set of elements with a certain order(ordered) but not necessarily ordered/classified(Sorted) in this case at least…
-
3
votes1
answer150
viewsA: Set Jobservice Android Runtime
To launch Jobservice you must use the Jobscheduler providing you with a Jobinfo. It is Jobinfo who informs Jobscheduler when Jobservice should be run. Jobinfo defines a set of rules that indicate…
-
1
votes1
answer70
viewsA: Display product output of two variables with dots instead of comma (c#)
Just as you did not need to use another variable to use the result of (horasTrabalhadas * valorHora) in the method Console.WriteLine(), also does not need it in order to use the method ToString().…
-
8
votes2
answers933
viewsA: Take the index of a value in an array
If you are still learning, the leonardosnt response code is more didactic. If you don’t use the method IndexOf() array class. char[] letras = new char[] { 'a', 'b', 'c', 'd' }; int indice =…
-
4
votes2
answers143
viewsA: Error #CS0176 in if statement, what am I doing wrong?
The error is due to the fact that the String class has a static method with that signature(public Static bool Equals(string,string)) and being qualified with an instance name. To use it you must…
-
2
votes1
answer1997
viewsA: One button click event
the alternatives presented only to I and III are valid. The class Button uses an interface implementation View.Onclicklistener to inform that the button has been clicked. This implementation must be…
-
4
votes1
answer126
viewsA: Error: Service Intent must be Explicit
For security reasons services should be initiated explicitly and should not have Intent Filters declared. From Android 5.0 is released this exception. Declare your service thus: <service…
-
2
votes1
answer30
viewsA: How to invert Control.Controlcollection’s list of controls?
Assuming that what identifies/distinguishes the label is its text(lbl.Text = i.ToString();), then just "reverse" the for: for(int i = 12; i >= 0; i--)…
-
4
votes2
answers1131
viewsA: onDataChange(), in addListenerForSingleValueEvent(), is only executed after my method returns
Queries made to Firebasedatabase have their results "delivered" asynchronously. To receive the result it is necessary to specify a Listener who will receive it, in this case a Valueeventlistener.…
-
9
votes1
answer302
viewsA: What is the Recyclerview?
Recyclerview is a view which allows displaying a part of a large data set. She resorts to several classes, namely to the Recyclerview.Adapter, Recyclerview.Layoutmanager and Itemanimator. The…
-
2
votes1
answer26
viewsA: Is it possible to use a specific Strings.xml for the Android version?
Yes, it is possible. The strings declared in xml strings. sane Resources and just like any Resource they may have statements alternatives per version/device characteristics. Create a new xml…
-
5
votes2
answers960
viewsA: How to make a Scheduledexecutorservice launch a new task while the previous one has not yet finished?
It is not possible and this is highlighted in documentation. If any Execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.…
-
4
votes1
answer32
viewsA: Replace or process obsolete method
Depends. The class that has this method exists in a compatibility library. Use this class and keep the library up to date. Class does not exist in the compatibility library. The method adds features…
-
1
votes2
answers91
viewsA: How to display Marker on the map according to the selected button?
If you want to control the Marker’s visibility after it’s been added, you must have a reference to it. The reference can be obtained at the time the method is used addMarker(). //Inserindo pinos…
-
2
votes1
answer689
viewsA: How do I make my app appear in the android menu (share via)?
You have to add an Activity statement on Androidmanifest.xml <intent-filter> including the action ACTION_SEND and the kind of content it will deal with. Example for text content:…
-
2
votes1
answer135
viewsA: How to display Cursor values using Debugger in Android Studio?
What you can see directly through Debugger, on the flap Variables, is the value of the fields of an object(variables). The Cursor object has no field with the column values of the current position.…
-
1
votes1
answer62
viewsA: Dbsqlite Android Studio Problem
You have a syntax error in SQL that creates the table. The correct syntax is IF NOT EXISTS and not NOT EXISTS Instead of CREATE TABLE IP NOT EXISTS use CREATE TABLE IP IF NOT EXISTS…
-
1
votes1
answer203
viewsA: Android Bullet style menu in Recyclerview item
The icon name is "more Vert". It can be obtained, in Android Studio, through Image Asset / Vector Asset.…
-
0
votes1
answer45
viewsA: Timepicker in 24h format
The Timepicker can present the value in both 24h format and AM/PM. The format is defined using the method setIs24HourView(). To set the format in 24h use it by passing true:…
-
1
votes2
answers101
viewsA: The application for when editText is not populated
When the content of an Edittext is used in a mathematical operation it is necessary to ensure at least that: is not null if(editText.getText().toString().isEmpty()){ // O conteúdo é nulo }…
-
2
votes1
answer329
viewsA: Error starting service on startup(ACTION_BOOT_COMPLETED)
This has to do with limitations imposed by Android 8 to the execution of services on background. These services can only be launched if the application is foreground Documentation suggests you use a…
-
4
votes1
answer173
viewsA: Event by clicking on a Google Maps marker
Use the method setOnMarkerClickListener(), from the map, to "set" a Onmarkerclicklistener who will have his methodonMarkerClick() called when the user clicks on it. GoogleMap googleMap;…
-
0
votes1
answer87
viewsA: How to capture the click on a sub-item of an Expandable List View
Instead of setOnItemClickListener() have to use setOnChildClickListener(). Pass to method one ExpandableListView.OnChildClickListener. In the implementation of its method onChildClick() use the…
-
3
votes1
answer176
viewsA: How do you check if two Drawables are the same?
You’re comparing a Drawable to a whole(R.drawable.ic_favorite_border is a whole). On the other hand, to compare Drawables, you must use the object returned by the method getConstantState(). Start by…
-
2
votes2
answers114
viewsA: Alternative to the Alarmmanager
The "alternatives" are: Jobscheduler Requires API Level 21 - See, in this reply, alternatives running at lower level API. Workmanager New api included in the brand new Android Jetpack. Uses support…
-
4
votes1
answer76
viewsA: Android - Detect specific word in an Edittext
Use the method contains() string class: if(search.getText().toString().contains("palavra")){ //entra aqui se a *palavra* estiver no texto } else{ //entra aqui se a *palavra* NÃO estiver no texto }…
-
1
votes2
answers839
viewsA: How do I get the Wi-Fi network name (SSID)?
Use an object Wifimanager obtained with Context.getSystemService(). WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); Use the method getScanResults() to obtain the list…
-
0
votes1
answer198
viewsA: Recycler view com async task
Pass the line mAdapter.notifyDataSetChanged(); into the method onPostExecute() @Override protected void onPostExecute(List<Convenio_Conselho_Grid_BD> convenio_conselho_grid_bds) { if…
-
2
votes1
answer275
viewsA: Separate line contents in the Bufferedreader loop
Do the split of line and treat each element of the array. Anything like that: while ((line = bufferedReader.readLine()) != null) { String[] values = line.split(" "); for(String value: values) {…
-
3
votes1
answer49
viewsA: Error using Asynctask more than once
The method execute() of an Asynctask can only be used once. You must always create a new instance so that you can use it. Note that this is what the bug reports: java.lang.IllegalStateException:…
-
10
votes2
answers1801
viewsA: Async/Await with threads (C# 7.2)
A common mistake is to think that asymchronism is synonymous with parallelism. The use of async is also not always well understood. Use async, alone, it does not render the method (the code it…
-
11
votes2
answers1011
views -
1
votes1
answer163
viewsA: Force Adaptive Icone to be square(Square)
If its application declares in targetSdkVersion API26 or above can do nothing. How the icon is displayed depends on the mask applied by the application "Launcher". It may be different from device to…
-
2
votes1
answer122
viewsA: How to have an Arraylist by composition
If that’s the method you’re gonna have public void setLojas(ArrayList<Loja> lojas) {} Then it will be enough to declare the Arraylist so private ArrayList<Loja> lojas; However, if you…
-
1
votes1
answer1495
viewsA: Remove() method does not remove Arraylist object
It doesn’t work because the Automovel that the method tries to remove does not exist in Arraylist. The method remove() uses the standard method implementation equals(), of the object to be removed,…
-
4
votes1
answer48
viewsA: column 'Minhacoluna' does not exist - Android Sqlite usage
The cursor returned by control.carregaDados() only returns the columns _id and item. See that in the implementation public Cursor carregaDados(){ //Sem Where Cursor cursor; String[] campos =…
-
2
votes2
answers30
viewsA: Component with same height
It is possible if done in java. Assign an Id to Linearlayout(android:id="@+id/linearLayout") and in the onCreate() add the following code: @Override protected void onCreate(Bundle…
-
3
votes2
answers472
viewsA: How to make a Textbox accept only the letters S and N?
What happens immediately is to intercept the pressed key, using the event KeyDown, and check which was. If the key corresponds to S or N the implementation must return e.Handled = false;, otherwise…
-
1
votes3
answers206
viewsA: Dynamic Array - Android
Just to show that this is possible with a multidimensional array, as AP requests. String valor0 = "1;2;3;4;5;6;7;8;9;0"; String valor1 = "1;2;3;4;5;6;7;8;9;0"; String valor2 = "1;2;3;4;5;6;7;8;9;0";…
-
2
votes1
answer87
viewsA: Like moving two buttons around?
Use a Gridlayout to deploy the buttons. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/lytKeyboard"…