Posts by viana • 27,141 points
761 posts
-
0
votes1
answer177
viewsA: Android Studio Scrollview - Is there any way to modify the size via code?
Instead of using: btnRefri[1].setVisibility(View.INVISIBLE); Use: btnRefri[1].setVisibility(View.GONE); Behold that answer of Thiago Luiz Domacoski more details on the difference between VISIBLE,…
-
2
votes1
answer940
viewsQ: Limit amount of typed characters based on view width
I got the following EditText width defined as match_parent, basically occupying the full width independent of the device: <EditText android:layout_width="match_parent"…
-
0
votes2
answers37
viewsA: Photo Album Android
The mistake is that you are using Uri.parse. You should actually enter the URL directly as a method parameter .load() in Glide or Picasso. See below for the correct information: Glide.with(this)…
-
0
votes3
answers303
viewsA: When I roll my listview I miss checkboxes marked
The problem the last condition does not have a else, then it ends up "intertwining" the items. Instead of putting: if(isChecked){ // conteúdo } if(!isChecked){ // conteúdo } Place: if(isChecked){ //…
-
4
votes3
answers1170
viewsA: Generate 5 digit combinations
A way to generate a combination with letters and numbers, would be using the function shuffle to mix the elements of a array and the foreach taking only the amount of characters passed as parameter:…
-
4
votes1
answer238
viewsA: Ignore attribute in POST using Retrofit
If you want the id does not appear in the serialized JSON, one way is to use the transient. Behold: private transient int id; See more details about the transient in the documentation and also in…
-
0
votes2
answers320
viewsA: Get the user’s location (City, State, Country) with the facebook login?
There is more than one way to do this. In documentation on Location, shows some examples and parameters that you need to use to rescue the location. On Android, you can make an asynchronous request…
-
0
votes2
answers1141
viewsA: Android calendar with events
You can use the DayViewDecorators. It would be something like: calendarView.addDecorators(new EventDecorator( getResources().getColor(R.color.coarCalendar), calendarDays)) See a simple example that…
-
1
votes1
answer2105
viewsA: Pass more than one parameter through the URL
As I explained in this question how to create a model to receive the values properly, as you need to pass some parameters, you can use the @Query. See below @GET("/restaurante")…
-
2
votes2
answers72
viewsA: How to recover value of an integer and set in a alertDialog
You must use the method setMessage within the condition just after assigning the desired value to its variable. See how it should look: if(!adulto.isEmpty()){ valorDigitadoA =…
-
0
votes1
answer75
viewsA: Android calendar for weeks and months
To "have the view for weeks" you need to modify the value of the method parameter setCalendarDisplayMode for CalendarMode.WEEKS. Basically alter from: setCalendarDisplayMode(CalendarMode.MONTHS)…
-
1
votes1
answer104
viewsA: How do I write the external data entry command in Java?
The scanf() in C is equivalent to Scanner in Java. See below for an example: Scanner scanner = new Scanner(System.in); // valores do tipo inteiros int n = scanner.nextInt(); // valores do tipo…
-
6
votes1
answer213
viewsQ: What is the architecture of Cleopatra?
There are several basic modern computer architectures. Here at Sopt has some questions, about von Neumann architecture and harvard. Recently, in a small reading, they cited another architecture,…
-
0
votes2
answers626
viewsA: Convert json array to retrofit
You have the array of pratos within the array of cardapio that is in an object. Basically this resolves your JSON: /** * Cardapio seria o model para receber o conteúdo do cardapio */ public class…
-
2
votes2
answers1201
viewsQ: How to return some* data with time interval?
I have a monitoring system. Recovers user location every 5 seconds. However, I want to show only the records that appear in the interval every 15 seconds (for example). The main idea is that it is…
-
1
votes1
answer29
viewsA: Login authentication
Your code should be like this to work properly: if (mEmail.equals(email) && (mPassword.equals(password)) { Intent intent = new Intent(LoginActivity.this, MainActivityListBooks.class);…
-
2
votes1
answer546
viewsA: Popular Listview Shapes with Retrofit 2
Solving the problem of "1400 lines": The ideal would be to work with paging. Instead of returning all results at once, make a request limiting the amount of items. As the scroll, you will be making…
-
2
votes1
answer1088
viewsA: How to use the textwatcher?
See an example of a 150-character limitation (visually only): editText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int…
-
0
votes1
answer487
viewsA: Return of JSON array
This way as you are doing, inserting the setText() inside the loop of repetition, every time the for give a complete cycle, it will override the previous value, causing it to show only the last…
-
1
votes1
answer1909
viewsA: How to use an Intent to open a PDF file by default android app
The problem of trying to create a intent is that there might not be any PDF reader installed on the device. Some companies put readers as standard apps, but this doesn’t always happen. Already the…
-
3
votes3
answers78
viewsA: Return Most recent date per Column?
You can create a WHERE to return the results of the last 3 days, for example: WHERE data_compra >= DATE(NOW()) - INTERVAL 3 DAY If it is longer, only you edit the interval. To query returns all…
-
0
votes1
answer210
viewsA: How do I check the blanks?
There is no error in comparing to string is empty. The only error is trying to use Float.parseFloat before checking if there is white space in the EditText or it is really empty. So just pass the…
-
1
votes1
answer173
viewsQ: Why does Progressbar hide behind the button?
I created a RelativeLayout with a button and a circular Progressbar. This way below: <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content"…
-
9
votes1
answer1654
viewsQ: What is a cellular automaton?
What is the cellular automaton about? What kind of problem can it solve? It’s something equivalent to turing machines?
-
3
votes1
answer1267
viewsA: Problem in making Textview display updated value
First you have to declare the variable numero globally outside the Initiating button with 0. private int numero = 0; @Override protected void onCreate(Bundle savedInstanceState) {…
-
1
votes1
answer2564
viewsA: Does anyone know how I can Scroll in Selenium Webdriver in JAVA
Scrolling down: WebDriver driver = new FirefoxDriver(); JavascriptExecutor jse = (JavascriptExecutor)driver; jse.executeScript("scrollBy(0,250)", ""); Scrolling Upwards: jse.executeScript("scroll(0,…
-
2
votes1
answer39
viewsA: Deformed alertdialog
Remove the title of AlertDialog. Behold: alert.requestWindowFeature(Window.FEATURE_NO_TITLE);
-
2
votes1
answer231
viewsA: Select Checkbox and enable fields on Android
Use the setOnCheckedChangeListener in his CheckBox. Thus below: arvorismoInfantil.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void…
-
3
votes1
answer407
viewsA: Error using Retrofit 2
For this situation you should use the @Path. Example: @GET("/?t={movieName}&apikey=11111") Call<List<MovieResults>> getFilmesByName(@Path("movieName") String movieName); If you do…
-
2
votes3
answers881
viewsQ: How to redeem all data of the current month grouped by date?
I have the following table: +------------+--------------+-------------------+ | ID | vacina | data | +------------+--------------+-------------------+ | 1 | Cinomose |2017-07-10 10:11:15|…
-
4
votes1
answer78
viewsA: Gradle error - Startup failed
The problem is occurring because there is no property support in Gradle, as stated on the line buildTypes {support:design, as well as in the error message itself: In case you tried to configure a…
-
1
votes1
answer79
viewsA: Nullpointerexception/ Button findViewById
You have to put the findViewById(R.id.botao_id) within the method onCreate() of his Activity. See how it should look: Button botao; @Override protected void onCreate(Bundle savedInstanceState) {…
-
0
votes2
answers52
viewsA: Save typed email and use it in a textview?
A simple form of data persistence is to use the SharedPreference as shown in the documentation on How to save key value sets. Below is an example of how to save, considering having a variable…
-
0
votes3
answers150
viewsA: Problems using string for resources
The answers already contained can solve the problem, but see below a logical explanation regarding the problem. The getString() is a method that is contained in the abstract class Context. The…
-
1
votes1
answer934
viewsA: Find . Keystore from APK
JKS(Java Keystore) you cannot find it if you have not yet created it. Formerly the certificate extension was .keystore then after a while Google changed to .jks. To create see the command below as…
-
1
votes2
answers1073
viewsA: Google Maps does not work after Gero APK Signed for Google Play
I’ve caught enough with this issue of sending APK and not working after launched. What you should note is that there is the mode DEBUG and RELESE in the app when the project is created in Android…
-
5
votes1
answer14089
viewsQ: Remove Google Maps bus stops/locations
I have this following code: <script> function init() { var myLatlng = new google.maps.LatLng(34.04, -118.24); var myOptions = { zoom: 13, center: myLatlng, mapTypeId:…
-
3
votes2
answers2623
viewsA: View PDF in Webview
Option 1 Use the Viewer from Google Drive. See how it should look: WebView ws = (WebView) findViewById(R.id.webview); ws.getSettings().setJavaScriptEnabled(true); String pdf =…
-
1
votes1
answer113
viewsA: Create an application shortcut in an onLogClickListener?
Usually when I use, I do it this way below: public void criarAtalho(){ // cria intent para criar atalho Intent shortcutintent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT"); // nega…
-
3
votes1
answer962
viewsA: Problems with Datepicker Orientation
If you want the DatePicker is viewed below the input, you must use: orientation: 'top' Should you want the DatePicker is displayed above the input, you must use: orientation: 'bottom' The rule is…
-
2
votes3
answers78
viewsA: Assist positioning div css
To fill the entire screen, you need to set position:absolute, height: 100% and width: 100%. If the position of div not be absolute, will not work only with height and width having total percentage.…
-
8
votes1
answer1301
viewsQ: What is Harvard architecture?
Reading a few things about architecture, in several cases it is compared to Harvard Architecture with Von Neumann Architecture. I found here in the SO this question about What is von Neumann’s…
-
2
votes1
answer2799
viewsQ: Special characters () appear in front of the XML tag
I am reading two XML files but created on different computers. This first was created on my computer: <?xml version="1.0" encoding="UTF-8"?> ... Already this below with same content appears a…
-
1
votes1
answer239
viewsA: Change the Drawableleft property of a Textview
You can use the method getView in his SimpleAdapter and the setCompoundDrawablesWithIntrinsicBounds defining in the first argument the drawable which in its case would be the R.drawable.tic14. This…
-
3
votes1
answer6203
viewsA: Permissions Androidmanifest.xml file
From the Android Marshmallow, API 23, users grant permissions to applications while they are running, not when they are installed. This approach optimizes the application installation process, as…
-
3
votes1
answer530
viewsA: Image capture for Base64
Just create a vector of bytes to receive the ByteArrayOutputStream using the method toByteArray converting bytes to a vector of bytes. Soon after import the lib android.util.Base64, create a string…
-
0
votes1
answer1341
viewsA: Creating bottom horizontal menu Android Studio
Behold in that reply how creating tabs, and to fix the TabLayout in the footer, insert a ViewPager previously defined the property layout_weight as 1. See how it should look: <LinearLayout…
-
0
votes1
answer19
viewsA: Alertdialog when there is an exception
Basically create a try catch and insert your code into the try. Should you make an exception within the try, will fall into the catch and will display a AlertDialog. See an example below: try { //…
-
5
votes1
answer282
viewsA: Record audio equal to Whatsapp
You can use the method setOnTouchListener on the button to redeem the tap. The MotionEvent.ACTION_DOWN is the event that captures the moment you clicked on the button. Already the…
-
0
votes1
answer93
viewsA: Toolbar disappears when I add another widget to Activity
The error occurs when the id of your <include> is different findViewById(R.id.toolbar);. In your case is android:id="@+id/include". See an example below: <include android:id="@+id/toolbar"…