Questions tagged as 'android'

1
answer

How to catch exceptions thrown by the insert () method?

I am using SQLite for a local bank in an Android application, my problem is that I am not able to handle health restriction exceptions. I have a table where the two fields are PK, that is, there can never be equal records. When I try to enter tw...
asked by 07.03.2018 / 03:38
1
answer

Concatenate an @string and a text in XML

I have a string called "key" and wanted to add the sequence numbers next to it in some textviews , but I do not know how to concatenate it in XML. For example: android:text="@string/key" + "1" android:text="@string/key" + "2" android:text="@...
asked by 01.03.2018 / 23:50
2
answers

Split a layout into 2 with different percentages

I wanted to know how I'd do to split a layout into 2 with 70/30 percent. I've got a way to split, but that way is not optimized for all devices.     
asked by 27.02.2018 / 17:51
2
answers

Help in spacing between EditText

I can not give a space between EditTexts in my project. the amount of EditTExts is generated according to the amount entered by the user, that is, it has been programmed in the Java Code. : //i.stack.imgur.com/lfOAW.png ">     
asked by 29.10.2017 / 22:13
1
answer

Text break by delimiter

I have the following text: Texto|Texto|Texto| I want to display it in a TextView, but every "|" (pipe) it will break the line. In this way: String texto = this.textoQuebrado; String[] array = texto.split("|"); conteudo.setText(...
asked by 20.10.2017 / 13:26
1
answer

How to find out if an ImageView has an informed photo

Hello, I want to create a conditional that checks whether all the fields on the screen were informed by the user or not. If anyone has not been informed, I would like to submit a toast showing the error. The problem is that on this screen I have...
asked by 22.10.2017 / 22:44
1
answer

Redeem user's phone number

On Android, using Java, you can retrieve the device user's phone number with the following code: TelephonyManager tMgr = (TelephonyManager)mAppContext. getSystemService(Context.TELEPHONY_SERVICE); String numero = tMgr.getLine1Number();...
asked by 19.10.2017 / 16:17
2
answers

Filter query with java android sqlite

public ArrayList<Contato> filtrar(String filtro) { ArrayList<Contato> contatoArray = new ArrayList<>(); //Consulta que traz todos dados de todas colunas Cursor cursor = database.query(BaseDAO.TABELA_AGENDA, BaseDAO....
asked by 18.09.2017 / 15:54
2
answers

Alternative to AlarmManager

I would like an alternative to schedule a notification other than AlarmManager. The reason is that when the phone is turned off and then turned on, the scheduled task is removed.     
asked by 17.05.2018 / 19:00
1
answer

Android Studio error passing array between activity

I'm developing an application that reads an item's barcode and compares whether it exists in a list with bank data. When one of these items is not present in the database, it must write the data to an array and send it to another activity where...
asked by 18.05.2018 / 00:04