Questions tagged as 'android'

1
answer

Refresh the text of a Toast without expecting it to add up

I am creating a test application and am using toasts to validate my tests. I usually define a toast as follows: Toast.makeText(this, "Texto que eu quero que apareça",Toast.LENGTH_SHORT).show(); Is there any way to change the text of a to...
asked by 04.05.2014 / 19:30
3
answers

How to pass value from editText to attribute to type int on Android?

I have a question regarding the storage of value from EditText to attributes of type int of a class. For attributes of type String I do this: objEquipamento.setMarcaModelo(edtMarcaModelo.getText().toString()); But when...
asked by 31.05.2014 / 23:33
1
answer

How do getHeight () not return 0 before the Draw method?

I have a problem where I need to make a ball appear in the middle of the getHeight () / 2 screen, the real problem is in the init () function where the value of getHeight () return me 0, which should return me the height value of the scree...
asked by 25.05.2014 / 22:20
1
answer

How to define a string coming from an sqlite database to display in a TextView?

I'm trying to display a string value in a textview through a query in sqlite, but when I run the code it displays a numeric log of the sqlite class of Android randomly. I'm just trying to display the string as the field value in the textview....
asked by 25.10.2018 / 17:27
3
answers

How to set the size of layout buttons in version 2.2

For example if I have a LinearLayout that occupies all the space horizontally, if I have two buttons, for each one occupy half the screen, how do I? GridLayout does not work in 2.2 right?     
asked by 23.02.2014 / 20:37
3
answers

How to convert pixel to dp?

I made an application that is a form, and I did everything via code without using xml, so my textViews and Edittexts stayed in pixels. On the tablet it works fine, but on the mobile with a lower resolution, everything is "encavalado".     
asked by 04.11.2015 / 15:44
1
answer

How to make a method wait for the server response in java using Retrofit2?

Hello friends I have the following method that requests the server: public MetaDataR metodo1(final String m) { Call<MetaDataR> call2 = new RetrofitConfig().getMetasService().getMetas(m); call2.enqueue(new Callback...
asked by 03.11.2018 / 14:56
2
answers

How to use onActivityResult when there is more than one startActivityForResult

I need to check the status of user yes or in when requesting bluetooth. But I already use the same method for speech recognition. Here is my code: package com.example.audio_auto; import java.io.IOException; import java.io.InputStream;...
asked by 14.02.2015 / 19:06
1
answer

If string starts with "www" automatically insert "https: //"

I'm trying to do the following For the user do not need to type https:// I'm trying to make, when the text of EditText starts with www. it will automatically insert https:// I've tried: if (!s_url.startsWith(...
asked by 15.02.2015 / 20:08
2
answers

Creating an array of type double (not a multidimensional array)

I need to pass two values of type double to a AsyncTask in my application. I tried to define an array using the following code: double latitude = location.getLatitude(); double longitude = location.getLongitude(); double[] coord...
asked by 23.06.2014 / 21:26