Posts by Thiago Luiz Domacoski • 7,310 points
323 posts
-
3
votes1
answer119
viewsQ: Moment - problem with Timezone
I receive the service date as follows: 2020-11-05T06:15:00.000-03:00 To display to the user we use the library Moment. Example: import React from 'react'; import moment from 'moment'; var chegada =…
-
4
votes2
answers82
viewsA: code decrease
This is a response based on opinions! There are several ways to perform the same operation. Here I present only one, based on my point of view! I believe there’s a way to make it more readable. For…
-
0
votes1
answer39
viewsQ: java.net.Proxy problem with Marshmallow and versions below
I have the following test : package com.technopartner.technosdk.proxy; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import…
-
1
votes1
answer58
viewsA: Hold the image and send to link in Android Studio
For simple touch, use the method setOnClickListener and to press use setOnLongClickListener. Follow an example: imageView.setOnLongClickListener(new View.OnLongClickListener() { @Override public…
-
1
votes1
answer90
viewsA: Problems with Sharedpreferences
I believe the value of mCoinCount is not updated when starting the App. Try it this way: @Override protected void onResume() { super.onResume(); loadAmount(); } /** * Método responsável por carregar…
androidanswered Thiago Luiz Domacoski 7,310 -
5
votes2
answers293
viewsQ: Uniquely identify the smartphone
I have an app that needs to uniquely identify a device. Even if the user removes and installs the app again, I would like the handle to continue the same. At first, I thought about using the…
androidasked Thiago Luiz Domacoski 7,310 -
2
votes1
answer101
viewsA: Share android html file
Yes! To share a file, you need to create and upload! Try it this way: In the archive Androidmanifest.xml add the write permission, so we can create the file before sending! <uses-permission…
androidanswered Thiago Luiz Domacoski 7,310 -
3
votes1
answer2198
viewsA: android QRCODE reader
For this, we will use the library ZXING In the build.Gradle(app) add libraries: implementation 'com.google.zxing:core:2.2' implementation 'com.embarkmobile:zxing-android-minimal:1.2.1@aar' In the…
-
1
votes1
answer416
viewsA: Copy HTML from a page display in a textview
Taking the example url into consideration, we can do it as follows: Analyzing the page, I considered that the content is within a DIV with the id mw-content-text. So let’s download the page, through…
-
2
votes1
answer40
viewsA: Error placing Imagebuttons with sounds inside Ragment
The Fragment works in a different way than a Activity: In the construction of Activity, we use the method onCreate(), where we inform which xml we will use through the method…
androidanswered Thiago Luiz Domacoski 7,310 -
3
votes2
answers3070
viewsA: How to leave the screen always on with the app open?
The best way to do that is to use the FLAG_KEEP_SCREEN_ON in his Activity (and only in a Activity, never on a service or other application component). For example: public class MainActivity extends…
androidanswered Thiago Luiz Domacoski 7,310 -
0
votes1
answer1101
viewsQ: SQL SERVER - return different columns from an Inner Join on the same row
I have the following scenario: Table users Table users On the table usuariosacessos, each line has the id user, the name of the functionality, and a field stating whether or not it has access. In my…
-
0
votes1
answer71
viewsQ: Link color declared in string.xml (Versions below N)
I have the following text stated in xml string.: <string name="TITLE_EXAMPLE"><![CDATA[ <p>Para entrar em contato com nossa Central:</p> <p><b>Brasil:…
androidasked Thiago Luiz Domacoski 7,310 -
0
votes1
answer35
viewsA: Iterate an Arduino String
I got it this way, but I still don’t think it’s the best way! Follows: #include <SoftwareSerial.h> #define led1 8 #define led2 9 #define led3 10 #define led4 11 #define led5 12 #define led6 13…
arduinoanswered Thiago Luiz Domacoski 7,310 -
0
votes1
answer35
viewsQ: Iterate an Arduino String
I would like to perform the following operation: Read a String (come by Bluetooh). This String will have 6 positions, each refers to whether an led. If it is 0 lights up the led or lights up! How do…
arduinoasked Thiago Luiz Domacoski 7,310 -
0
votes2
answers2044
viewsA: How can one Fragment call another Fragment?
Your Activity must have one <fragment>: <fragment android:id="@+id/ android:layout_width="match_parent" android:layout_height="match_parent"/> Try it this way: /** * Informe a Activity…
androidanswered Thiago Luiz Domacoski 7,310 -
1
votes1
answer85
viewsA: Android take data from Imagebutton to send in a post
I believe your problem is in onActivityResult! When the method onActivityResult returns, he already delivers a URi where we can set directly on ImageButton: photo.setImageURI(data.getData()); Also,…
-
2
votes3
answers1406
viewsA: Handling JSON with JAVA
To turn the result into an object, we can use the library GSON Follow the download link To make the request, we use Httpsurlconnection Follow an example: import java.io.BufferedReader; import…
-
3
votes2
answers340
viewsA: How to create an array whose indices are characters from an informed string?
Try it this way: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Teste { public static void main(String[] args) { /** * Vamos utilizar para…
-
1
votes1
answer927
viewsA: How to share app audio for Whatsapp?
Try it this way: /** * É necessário salvar o arquivo no External Storage do usuário, para compartilhar */ public void onClickshe() { InputStream inputStream; FileOutputStream fileOutputStream; try {…
-
1
votes1
answer128
viewsA: String Conversion to Double returning null
When you invoke the method onCheckedChanged (with changes in the component RadioGroup1) it is probable that the values of vDiametroRolo1 and vComprimentoRolo1 are empty (as stated in the question…
-
1
votes1
answer282
viewsA: Attempt to invoke virtual method 'long Contactodao.alterar(Contact)' on a null Object Reference
ERROR: java.lang.Nullpointerexception: Attempt to invoke virtual method 'long costamilam.guilherme.contact us Press.ContactoDAO.change(costamilam.guilherme.contact us Press.Contact)' on a null…
-
4
votes3
answers1479
viewsA: What is this "Could not find method schedule(View) in" error?
Error free translation: java.lang.Illegalstateexception: Unable to find method schedule(View) in Class or Context for android: onClick attribute defined in the display class…
-
1
votes2
answers920
viewsQ: How to know which Fragment is being displayed
My app has an Activity that controls the inclusion of Fragments. Follows: public static void adicionarFragment(Activity activity, Fragment fragment){ FragmentManager fragMgr =…
-
1
votes1
answer202
viewsQ: Change FAB color via code ( programmatically )
I’m developing a Activity customized, where the colors of the screen elements will vary according to their properties. Example: If the property guy of the object Message exhibited is "Azul", then…
-
1
votes1
answer659
viewsA: Apply data from a txt to Arraylist
For this, we can use the method split. This takes an expression that will divide the String among the elements: Example: "boo:and:foo".slpit(":"); will result in: { "boo", "and", "foo" } In your…
-
1
votes2
answers369
viewsA: Passing parameter to another Activity with sharedPreference
/** * Inciamos o SharedPreferences com o mesmo name que salvou */ SharedPreferences settings = getSharedPreferences("PREFS_NAME", 0); /** * Vamos pegar o valor da chave.…
-
1
votes1
answer415
viewsA: Onitemclicklistener to open an Activity
One simple way to solve is to add class of Activity with a class property Pokemon1 Example : Pokemon1.java public class Pokemon1 { public Pokemon1(final String nome, final String numero, final…
-
0
votes3
answers278
viewsA: How to find Uri from Gallery on Android 7 nougat
From the Android 6.0 (API level 23), users grant permissions to applications while they are running, not when they are installed. This approach optimizes the application installation process as the…
androidanswered Thiago Luiz Domacoski 7,310 -
0
votes2
answers444
viewsA: How to make FAB overwrite items in a Listview
Try it this way: XML <ListView android:id="@+id/list_exercicios" android:scrollbars="vertical" android:layout_width="match_parent" android:layout_height="match_parent"…
androidanswered Thiago Luiz Domacoski 7,310 -
1
votes1
answer329
viewsA: Component on another Android
The RelativeLayout takes into account the order of the elements, so put first the ImageView first to get him behind the TextView Follows: <?xml version="1.0" encoding="utf-8"?> <FrameLayout…
-
5
votes1
answer864
viewsA: How do I call a progressBar inside the Dialog?
Follow an example: private Dialog mDialog; public void openDialog(){ mDialog = new Dialog(this); //vamos remover o titulo da Dialog mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); //vamos…
-
2
votes1
answer489
viewsA: How can I browse this JSON and recover the Movies list?
This NullPointerException occurs because within CatalogoMovies there is a List of Movie! The structure of Objects is different from the JSON that you added to link. The List is within data: { //…
-
1
votes2
answers260
viewsA: Retrieve json object
The Body of your responseis already your object! So try it this way: private void getUsuario ( Service service, int codigo ){ Call<Usuario> userCall = service.getUsuario( codigo );…
-
2
votes1
answer155
viewsQ: REGEX - problem with validation
I need to do the following validation: a-z (upper and lower case), hyphenate (-), apostrophe (\'), space ( ) and numbers (0-9) For that I did the following: import java.util.regex.Matcher; import…
-
1
votes1
answer1114
viewsA: How to pass information between screens, using Bundle and Classes with Get and Set?
What your mistake says: EXCEPTION: main Process: com.vuforia.samples.Books, PID: 16338 java.lang.Runtimeexception: Unable to instantiate Activity Your class Books is not registered as a Activity…
-
1
votes2
answers143
viewsA: Button that click sends to location?
Try it this way: private void abrirRota(){ /** * Nossa intenção será um google.navigation * Temos os seguintes parametros: * q= [Destino, endereço ou Latitude e longitude]; OBRIGATÓRIO! * mode=…
androidanswered Thiago Luiz Domacoski 7,310 -
0
votes2
answers467
viewsA: Authentication screen with Sqlite
Try it this way: public Usuario UsuarioAutenticar (String user, String senha){ final SQLiteDatabase db = bancoDados.getReadableDatabase(); /** Aqui você deve colocar todas as colunas que deseja…
-
2
votes1
answer102
viewsA: Error synchronizing grandle with mask library for fields
Occurs the following: The above library uses this same Tag Label! To correct it is necessary to specify in AndroidManifest which will be used by your application, as suggested in the error:…
-
1
votes1
answer79
viewsA: Login Firebase using Googlesign
I was able to solve it as follows: In addition to updating the file google-services.json I used the Web key Client no generated on console.developers.google.com This is requested in the following…
-
1
votes1
answer129
viewsA: Android error post method
In order for the application screen to not lock onto the user, it is not possible to perform a large operation on the Thread Userinterface (UI) of the Application. So, when making a request you…
-
1
votes1
answer79
viewsQ: Login Firebase using Googlesign
I’m trying to log into the application in Firebase through Googlesign this way: import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import…
-
1
votes1
answer1160
viewsA: How to share an image (Imageview) using Intent?
It is necessary to save the image so that it can be shared: Come on: Permission: In his file Androidmanifest.xml add the permission so we can save the image on the device: <uses-permission…
-
1
votes1
answer159
viewsA: How to send Push notification
For this use if the Notificationcompat.Builder Follow an example: /** * Identificador da Notifição */ public static int ID_NOTIFICACAO = 9817; private void gerarNotificacao(){ /** * Vamos criar um…
-
1
votes1
answer64
viewsA: How to call initLoader inside Onclicklistener
The problem occurs because within the OnClickListener, the context is another! Within the onclick method, your this is an Onclicklistener and not a LoaderCallbacks! Try it this way:…
-
1
votes1
answer28
viewsA: The string did not come empty so calls another Android screen
According to the error says, it is necessary that your contentView must have a declared Listview with the id attribute equal to android.R.id.list. I believe that to customize the list (and Adapter)…
-
5
votes1
answer4234
viewsA: retrofit - How to send a JSON via POST
Try it this way: Instead of sending a String send a Requestbody! @POST("login") Call<BaseRequest> requestJson(@Body RequestBody object); Example to instantiate the RequestBody: final String…
-
6
votes1
answer2013
viewsA: How to use runOnUiThread()
Definition of the method: "Executes the action specified in the UI Thread. If the current Thread is the UI thread, then the action will be executed immediately. If Thread not currently in the UI,…
-
3
votes1
answer44
viewsQ: How to reverse the animation of an Animated-vector?
I am using the following Animated-vector: <animated-vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"> <aapt:attr…
-
2
votes1
answer351
viewsQ: List files from a specific folder
I have the following code: public static final String PATH ="/Conceitos"; public static List<String> loadFilesName() throws IOException{ List<String> strings = new ArrayList<>(0);…