Posts by rsicarelli • 3,086 points
110 posts
-
1
votes2
answers993
viewsA: What alternative website to Admob for the Android app?
I recommend using the MoPub that is part of the Fabric (Twitter). Its implementation is super simple, and has several types of ads. Moreover, here you can find a great example how to implement and…
-
3
votes1
answer1570
viewsA: How to assign click effects to an Imagebutton?
You need to create a drawable for it, stating the colors for the respective states. To do this, create an . xml file inside the folder drawable: <selector…
-
1
votes2
answers1930
viewsA: How to open pdf on Android?
If you want to open your folder assets try something like this: private void readFromAssets(String filename) { AssetManager assetManager = getAssets(); InputStream in = null; OutputStream out =…
-
3
votes1
answer690
viewsA: How to add reticence if content leaks from Android layout?
The TextView has an attribute called ellipsize, which, according to the documentation, allows the addition of ... automatically if the word is too big, instead of breaking in the middle. In your…
-
3
votes2
answers154
viewsA: Android studio has ndk support?
From the Android Studio version 1.3, has full support for NDK, including a native debug. The plugin is based on Jetbrains Clion Platform. Source:…
-
1
votes2
answers4054
viewsA: Error message (Error:Execution failed for task ':app:processDebugManifest')
This happens when you are using some library that, in its manifesto, requires a specific minimum version for its operation. In your case, the Google Play Services requires a minimum version from the…
-
3
votes3
answers917
viewsQ: Formatting String with Dateformat using a Timezone is not working
In my web service, there is an endpoint that returns a timestamp to me UTC and I have a method that generates a date formatted from this timestamp: formatDate(1432313391, "UTC"); public String…
-
1
votes1
answer278
viewsA: How to go to the top of an Activity on Android
You can go to the top of your ScrollView "smoothly": suaScrollView.smoothScrollTo(0,0); Or: suaScrollView.scrollTo(0,0);…
-
3
votes1
answer2031
viewsA: Distorted background image in Android Studio
Making any image, whether background or not, with the specific size of the device you are testing is very risky. You can never ensure that the image is perfect in all scenarios. As much as the…
-
1
votes2
answers2746
viewsA: How to recover a string-array item within my Activity layout in the "xml" case?
You can load into an array of Strings: String[] mArray = getResources().getStringArray(R.array.string-array); And, to set, you can do through a simple interface, as: for (String mString : mArray){…
-
1
votes1
answer691
viewsA: Listview is catching up
The problem is that Voce is processing your image within your Thread UI. To solve this problem, Google itself recommends AsyncTask, that runs everything in the background and outside of your Thread…
-
1
votes2
answers376
viewsA: Pinch android zoom
Try to use the TouchImageView, it supports Pinch zoom, double tap and other features. To implement it, just reference it in your layout: <br.com.seupacote.TouchImageView…
-
1
votes1
answer164
viewsA: Android: how to group buttons?
There is no component that does this for you similar to RadioGroup. You have to do this via code, something like: ... firstButton.setOnClickListener(new View.OnClickListener() { @Override public…
androidanswered rsicarelli 3,086 -
0
votes4
answers3216
viewsA: How to know if the app is open
To implement what you want, we need to understand a little bit about the life cycle of a Activity. onCreate() is where you boot your Activity. Here you call the method setContentView() with your .…
androidanswered rsicarelli 3,086 -
1
votes2
answers81
viewsA: How to keep the layout in standby mode?
You can add the attribute android:configChanges="orientation" within the tag <activity> in his AndroidManifest.xml. This configuration causes instead of recreating the Activity when changing…
-
3
votes1
answer109
viewsA: How to lock a layout on ORIENTATION_LANDSCAPE and another on ORIENTATION_PORTRAIT
You can use the folder res to create specific layouts for Portrait or Landscape. The briefcase layout inside the briefcase res, serves for generic layouts, without any "treatment", for any type of…
-
1
votes1
answer599
viewsA: Use a private key for all apps
The private key serves to verify and prove that Voce owns the app. Any APK that is going up to the store, needs to be "signed" by that private key and prove that it is a true build. For every…
androidanswered rsicarelli 3,086 -
0
votes3
answers468
viewsA: How to pass arguments for running an android app?
You can make this setting in your Application. To Application is the first thing it performs, before any Activity. Within your Application you can, for example, load/persist information from your…
-
5
votes1
answer1419
viewsA: APP Communication with Web Server
You can use Google’s official library for this, the Volley. It is very easy to implement and there are several examples (besides the official documentation). Along with the Volley, recommend you use…
-
1
votes1
answer686
viewsA: Enable android keyboard "Search" key
This button on the keyboard is called IME, and you can configure (in your case) through the attribute android:imeOptions="actionSearch": <EditText android:layout_width="match_parent"…
-
3
votes2
answers4578
viewsA: Android Toolbar: center title
Remember that the Toolbar is a ViewGroup, that is, you can put components inside it without any problem. To place a text in the center, place a TextView as the attribute android:gravity="center":…
androidanswered rsicarelli 3,086 -
3
votes1
answer3150
viewsA: Enable / Disable GPS on Android 4.4.2
As of version 2.3.3, you can no longer enable/disable gps without user approval. All you can do is open the GPS activation screen if necessary: LocationManager locationManager = (LocationManager)…
-
0
votes1
answer773
viewsA: align Linearlayout
You can set the size of each item in your GridView calculating by device size (inside your Adapter): int size; //Recuperando a quantidade de colunas que você declarou para seu GridView if…
androidanswered rsicarelli 3,086 -
0
votes1
answer1070
viewsA: Change Actionbar Menu Background
You have two options: 1) If you are using the Toolbar (if not using, recommend), you can insert components into your Toolbar and stir as you like. For example: <?xml version="1.0"…
androidanswered rsicarelli 3,086 -
1
votes2
answers162
viewsA: Android getIntent error
You don’t need to put one Bundle as an extra to your Intent, since, the extra of his Intent is already a Bundle (according to the documentation). So, you just need to do the following: ... Byte…
-
0
votes1
answer103
viewsA: Callback after moveCamera on Google Maps
You can use the interface OnCameraChangeListener, which is called every time there is a movement on the map. Inside this callback, you check the visibility of your Spinner just not to change his…
-
1
votes2
answers215
viewsA: Problem with XML Linearlayout
The problem is that you’re putting the Button within the item in your list and, when you inflate it, you will have a button for each item. To resolve this issue, you must remove the Button and the…
-
3
votes1
answer6204
viewsA: How to increase the font size of an Edittext according to the screen size?
you can create a file dimens.xml for each type/screen resolution: 1) Create a folder values for resolutions you want to treat individually, example: values-hdpi, values-mdpi etc.. 2) Inside the…
-
1
votes2
answers196
viewsA: Doubt with Dialog
You can check through the method isShowing() (don’t forget to check if it’s null, just in case): if (mDialog != null && mDialog.isShowing()){ //suas implementações } Reference:…
-
1
votes1
answer485
viewsA: Error compiling project in Gradle
I had the same problem just this week. I managed to settle by going on: File > Settings > Gradle > on the Gradle VM Option place -Xmx256m (if you want to increase, feel free. In my Android…
-
1
votes1
answer4842
viewsA: How to Restore Factory Settings from Android Studio?
The Android Studio saves your settings to a folder called .AndroidStudio which is usually in C:\Users\seuusuario. To reset the settings, simply delete this folder and open yours again Android…
-
4
votes1
answer1247
viewsA: Change Actionbar button icon
You need to overwrite the methods onCreateOptionsMenu and onOptionsItemSelected 1) Retain the MenuItem desired: private MenuItem menuCoracao; ... @Override public boolean onCreateOptionsMenu(Menu…
androidanswered rsicarelli 3,086 -
1
votes2
answers4369
viewsA: Function that returns screen resolution
You can use the DisplayMetrics: DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); int height = displayMetrics.heightPixels; int widht = displayMetrics.widthPixels; Note: the…
-
1
votes2
answers643
viewsA: How to set a time to close image when opening
You can do this in a "dry" and lively way (which I think is best) To make animated way, you can use the ObjectAnimator to lower the Alpha: private void fadeOutImage() { ObjectAnimator objectAnimator…
-
1
votes1
answer438
viewsA: My listview is click-free
This problem occurs when you have an item on your list that has a focus, (your Button) what causes not to call the method OnItemClickListener (see this bug reported here) This is not to say that you…
androidanswered rsicarelli 3,086 -
2
votes2
answers5781
viewsA: How to configure an image in Imageview so that it takes the entire screen of the phone
First, use MATCH_PARENT when you want your View occupy all screen space. Property FILL_PARENT was discontinued from API 8. Take a look at the parameter android:adjustViewBounds to make your…
-
2
votes1
answer88
viewsA: Create id for a new Listview?
Using the prefix @android:, indicates that you are trying to reference a resource directly from the imported android SDK in your project. Following the documentation:…
-
2
votes3
answers6632
viewsA: Float button
From SDK 21, you can use the ViewOutlineProvider: 1) Create a layout within a folder layout-v21 in your project, inserting a ImageButton: <ImageButton android:id="@+id/floatingButton"…
androidanswered rsicarelli 3,086 -
1
votes2
answers1486
viewsA: Convert a bitmap image to a URL and set in Imageview
You can utilize the Universal Image Loader, which does all the heavy lifting for you in a fast and effective way. To implement it in your project is simple: 1) Lower the . jar at this link and…
-
0
votes1
answer114
viewsA: Error reopening Map in Fragment inside Drawerlist
This is a problem that happens when you use Fragments and the MapFragment. I suggest you replace it with MapView, you won’t have that problem. But anyway, the solution to your problem is by putting…
-
7
votes3
answers3512
viewsA: How to decrease the quality of an image on android?
This is very common. And in addition to the slowness, you can catch the famous Exception OutOffMemory. To prevent this, you can solve two (simple) steps within your Adapter: 1)- Place all image…
-
0
votes1
answer878
viewsA: Using Intent.ACTION_SEND share text on facebook
This actually happens and is how it was designed, according to Facebook. Take a look at this bug report: Jesse Chen Facebook Team Hi Facebook Developers, This Issue is going to be closed by design…
androidanswered rsicarelli 3,086 -
5
votes1
answer683
viewsA: Doubt about canvases of a questionnaire (quiz)
Your question can be answered with a simple context analysis: It makes sense for you to change the user context (change Activity) just to change the question? If you think it makes sense, then the…
androidanswered rsicarelli 3,086 -
2
votes1
answer1792
viewsA: Run another application (maps) in my menu
You need to call Google Maps via Intent, thus: private void callExternalMap(LatLng origem, LatLng destino) { try { Intent intent = new Intent(android.content.Intent.ACTION_VIEW,…
androidanswered rsicarelli 3,086 -
0
votes2
answers226
viewsA: Bundle coming up void
The problem is that in your code, you’re putting the Bundle in Intent before defining his extras: Bundle bundleParametro = new Bundle(); telaWeb.putExtras(bundleParametro);…
androidanswered rsicarelli 3,086 -
1
votes1
answer145
viewsA: Expandablelistview Com Formulario
You can do with the Transitionmanager, but is only available in API 19. A solution, something like this 1- In your layout, put inside some container (Relativelayout, Linearlayout, Framelayout etc.)…
androidanswered rsicarelli 3,086 -
4
votes2
answers270
viewsA: Modify XML features through Java
You need to use a class called Layoutparams, according to its layout (in this case, a Relativelayout). To add rules, you use the method addRule(), for example: RelativeLayout mRelativeLayout =…
-
1
votes1
answer484
viewsA: Doubt with Notification and Alarmmanager
If I understand correctly, what you need is the following: First you need to create a BroadcastReceiver for his AlarmManager call for: public class AlarmReceiver extends BroadcastReceiver { public…
-
2
votes1
answer494
viewsA: Display an Image via URL
You have some options on how to implement this functionality in your project. The first (which I particularly prefer) is using the Universal Image Loader, a super easy to implement library and you…
-
1
votes2
answers132
viewsA: Edittext is deleted when use setSelection() within onTextChanged method
A great solution would be the implementation of an already Android class, the PhoneNumberFormattingTextWatcher: PhoneNumberFormattingTextWatcher mPhoneWatcher = new…