Posts by Caique Oliveira • 1,143 points
63 posts
-
-1
votes1
answer921
viewsA: Open pdf document via Intent?
Remove setDataAndType Add Uri and type separately as follows: Intent.setType("application/pdf") // identifica o tipo de arquivo que vc quer compartilhar, isso permite que a lista de programas…
-
0
votes2
answers102
viewsA: How to use the Sharedpreferencesutils.java class?
PREF_EXAMPLE is not used in the code. The PREFS_FILE variable has been kept private only for us to change where it is saved. What this class does is encapsulate code so you don’t need to copy and…
-
1
votes1
answer562
viewsA: Wait for the results of asynchronous Firebase methods
Your Toast and the Intent must be called inside the onDataChange, which is the moment you have all the necessary information. preferencias.salvarPreferencias(id_user_logado,…
-
0
votes1
answer162
viewsA: How to migrate to the new version of Realm
If you are referring to how to update your Android Studio Gradle you can find the information here: https://realm.io/docs/java/latest/#installation If you are referring to making a Migration, you…
-
1
votes1
answer260
viewsA: softkeyboard pushing layout up
This setting is done on Androidmanifest. In case you don’t want you need to change the value of the tag below: android:windowSoftInputMode You can find the explanation and values of this tag in the…
-
1
votes1
answer38
viewsA: What code to use to insert the result into an Imageview?
Use the lib Glide she is recommended by google: It has a simple syntax Glide.with(context).load("url").into(imageView); To add lib to your dependencies add to Gradle: compile…
androidanswered Caique Oliveira 1,143 -
1
votes1
answer791
viewsA: How to check if the field is filled in
In the second if you forgot the toString(); do: String cnpj1 = cnpj.getText().toString(); If(!TextUtils.isEmpty(cnpj1) && cnpj1.length == 14){ if(!isValidCnpj(cnpj1))…
-
0
votes2
answers1854
viewsA: How to receive data using Firebase
I believe you are not using the new android sdk as suggested error. If so you should upgrade your Radle see the documentation To use each new firebase feature you must add each department…
-
0
votes1
answer147
viewsA: Firebase + Android + Spring to create Microservices
You can check if he is logged in, by documentation we have the following method: mAuthListener = new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth…
-
0
votes2
answers738
viewsA: Update of Fragments Tabs!
Alter FragmentPagerAdapter for FragmentStatePagerAdapter If it doesn’t work, you can do the following Create an interface with a "upgrade method" Your Fragment Listbasicafragment should implement…
-
0
votes2
answers416
viewsA: Alertdialog button to confirm ERROR
java.lang.Illegalstateexception: You need to use a Theme.Appcompat Theme. Check the theme you are using in Activity. As stated in the error you need to use an Appcompattheme.…
-
1
votes1
answer213
viewsA: My app that has Listview with Arrayadapter is closing when creating the list
You are using an Arrayadapter, it by default expects a Textview as layout. You can change your super call to super(context, layoutResourceId); must solve You can extend from a Basedapter You can use…
-
0
votes1
answer148
viewsA: How can you make an automatic table , with organization and "pagination" in android?
Use a recyclerView and create a layout for the row and another for the header (this should be called when the position returns 0) Here has an example of pagination. Possible ways of organising: When…
androidanswered Caique Oliveira 1,143 -
4
votes2
answers639
viewsA: Registration screen skipping field with "Enter"
Usa android:maxLines="1" the android:singleLine has recently become obsolete
androidanswered Caique Oliveira 1,143 -
0
votes1
answer155
viewsQ: Expandablelistview using Recyclerview?
Hello, I had to create a few times recyclerview which had the same principle as expandablelistview for that, I have always made use of this lib It solves the problem. But this is a good solution?…
androidasked Caique Oliveira 1,143 -
1
votes3
answers99
viewsA: Firebaseexception: Failed to Bounce to type
You are trying to access the firebase root node, it has other nodes besides Train. The return is telling you that it is not possible to transform the json object received from firebase to your Pojo.…
-
5
votes1
answer281
viewsQ: Text gradient android
It is possible to create a gradient in the text (and not in the background) of a textView using only XML? I know using Shader it is possible to do with code(here) It is possible to do this using…
-
0
votes1
answer48
viewsA: Is there a downside to having a high number of Activities? What is the alternative?
Use Fragments is what google recommends, when you create many activities you end up recreating unnecessary views and codes. About Ragments you can read here and here…
androidanswered Caique Oliveira 1,143 -
1
votes1
answer115
viewsA: Pass an Activity company id to another and use in a database connection
Use putExtra, in the Intent that calls the next Activity do: Intent i = new Intent(...); i.putExtra("Id", "123"); On the call Activity do: Bundle b = getIntent().getExtras(); Log.i("id",…
-
0
votes2
answers76
viewsA: Get photo from google plus profile
I solved my problem this way: GoogleSignInAccount acct = result.getSignInAccount(); String url = "http://" + acct.getPhotoUrl().getAuthority() + acct.getPhotoUrl().getPath() + "?sz=76"; And to…
-
0
votes1
answer176
viewsA: When navigating on Fragment screens and returning, the screen turns white
Use: FragmentAdapter fragmentAdapter = new FragmentAdapter(getChildFragmentManager() , fragments); Source: here…
-
0
votes2
answers76
viewsQ: Get photo from google plus profile
I have the following method to perform a Silentlogin with google + private void silentLogin() throws MalformedURLException { OptionalPendingResult<GoogleSignInResult> pendingResult =…
-
11
votes1
answer2979
viewsQ: "java.lang.Securityexception: Permission Denial" on Android 6 Marshmallow (API 23)
I’m trying to register a broadcastreceiver so I can check a new sms that might arrive on the device. I’m getting an error only on android marshmallow in the following snippet of my code: public…
-
0
votes2
answers148
viewsA: Object sent by Android arriving Null on Webservice server
Make a request for your webservice using the Postman and see if the object will arrive null. If it arrives you will know that the problem is not at first on android. Also try printing the object…
-
2
votes1
answer567
viewsA: Set text if selected android checkbox
Try to use the Istener: setOnCheckedChangeListener new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {…
-
4
votes1
answer3748
viewsA: Load imageView using image path
File imgFile = new File("SEU FILE PATH"); if(imgFile.exists()){ Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath()); ImageView myImage = (ImageView)…
-
4
votes1
answer896
viewsA: How to change the name in the top bar dynamically when a Fragment is selected?
@SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. id = item.getItemId(); if (id ==…
-
1
votes1
answer1057
viewsA: How to get the result of the Retrofit 2.0 Request
return the following json {"api_key":"API_KEY_AQUI"} Create a model class that represents the same public class suaclasse{ private String api_key; //get and set } Update your interface…
-
1
votes1
answer267
viewsA: Error sending Arraylist via POST in Retrofit 2: java.lang.Illegalstateexception: Expected BEGIN_ARRAY but was STRING
Modify the feedback you want to receive in your interface. We have: @POST("envia") Call<List<ModelContato>> createRContato(@Body ArrayList<ModelContato> modelContato);} This means…
-
1
votes2
answers2499
viewsA: Android: Send data via POST
Use the retrofit, read on: here Example of use: Create an interface: public interface SUAINTERFACE { @POST("users/new") Call<User> createUser(@Body User user);//dados passados no corpo }…
-
1
votes1
answer1165
viewsA: How to make a simple image gallery for Android?
The best known is this lib here , more information about her: here Example of use: public class AdapterCircleIndicator extends FragmentStatePagerAdapter { private int mCount; public…
-
0
votes1
answer121
viewsA: How to use Sharedpreferencesfrom Android? Can I choose several filenames?
You can try to do the following: public static void saveMyPlace(Context context, MyPlace myPlaces) { SharedPreferences prefs = context.getSharedPreferences(Constants.MY_PLACES,…
-
0
votes3
answers2316
viewsA: Google Maps does not load
You need to create a maps project( here) for it to give you a key. This key should be added in your google_maps_api.xml file where it will be: ADD_API_KEY_HERE. In order for you to get a key to…
-
0
votes1
answer290
viewsA: Implementation of recyclerView within tabLayout
The recyclerView should be added to the View in which you will display. As you will display one of the 3 fragments, then you should add the recyclerview in one of these 3. The same principle works…
androidanswered Caique Oliveira 1,143 -
0
votes1
answer485
viewsA: Check Facebook button login on Android
The "Sign Out" button indicates that you are already logged in, when you click Sign Out you just log out of the app and login again, what you need to do is check whether its identifier is null or…
-
1
votes1
answer45
viewsQ: JSON does not complete when sending by Bundle
I’m trying to get the return of a push on android through the Bundle, but I’m having some problem performing bundle.getString("Message"); as it does not take all my reply which is in JSON format,…
-
1
votes1
answer670
viewsA: How to make the text fit in the text box on Android?
See this library https://github.com/grantland/android-autofittextview if I understood your question would be what you’re looking for.…
-
2
votes1
answer548
viewsA: How to change Activity by clicking on an option in the Alertdialog menu?
Before I go to the next activity call the method dismiss() dialog and then call the method openPedidos()
-
1
votes3
answers1444
viewsA: List of questions, each question with a list of answers
I’ve done something similar these days, I hope I can help you. In my problem I dynamically add an amount of textView’s, this amount varies according to a size of an Arraylist. You can adapt to your…
-
1
votes2
answers382
viewsA: layout problems in Android Studio
In the xml inside the Activity tag set your screenOrientation to Portrait, example: <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name"…
-
1
votes1
answer66
viewsA: Android app error 5
inside the res folder create the drawable-nodpi folder and put your bitmap inside it
-
3
votes1
answer137
viewsA: How to create a new window for each button clicked?
You can solve this with a dialog. When creating the dialog you need to define a layout in which you will be asked for the information you want to request regarding each table. Below is an example…
-
14
votes2
answers13793
viewsA: Block android rotation
You must go in the manifest of your project and for each Activity you must add the following line android:screenOrientation="portrait" Example <activity android:name=".MainActivity"…
-
0
votes1
answer115
viewsA: With this rule, how do I view the point closer to my location
Calculating the distance between 2 points public static double distFrom(double lat1, double lng1, double lat2, double lng2) { double earthRadius = 3958.75; // miles (or 6371.0 kilometers) double…
-
4
votes2
answers234
viewsA: JSON treatment returned from PHP
You can follow the following steps 1-create classes pojo 2-add the retrofit lib to your project 3-perform requests using the Rest concept (hence step 2) 1 create pojo classes The class "pojo" serves…
-
1
votes2
answers4265
viewsA: How to create a PDF using iText for Android
See the gist I created below, maybe it can still be useful for you. pdf
-
0
votes2
answers993
viewsA: How to get data from a text displayed in the dialog
Try this: private AlertDialog alertDialog; private LayoutInflater inflat; private AlertDialog.Builder builder; inflat = (LayoutInflater)…
-
2
votes1
answer6645
viewsA: How to call a Fragment from an Activity button
A Fragment shall be associated with a Activity so that it can be displayed. For this you must define a space within the Activity(a container). Here is an example. <LinearLayout…
androidanswered Caique Oliveira 1,143 -
0
votes2
answers107
viewsA: How to prevent an Activity from being created again? Is calling it once?
You can do the following, whenever you finish filling the form you change your listview Adapter and call the method meu_adapter.notifyDataSetChanged(). I answered something similar here…
androidanswered Caique Oliveira 1,143 -
0
votes3
answers189
viewsA: Handling items from an Action Bar outside the onCreateOptionsMenu()
You can use the method invalideOptionsMenu() That will force the method call onCreateOptionsMenu()