Author name: Laura Prata

Solutions

Android Custom Edit Text Cursor Not Visible

[vc_row boxed_columns=”” section=”” vertical_centering=”” video=”” video_opts=”” multi_color_overlay=”” height=”medium” color_scheme=”” us_bg_color=”” us_text_color=”” us_bg_image=”” us_bg_video=”0″][vc_column animate=”afl” animate_delay=”0.2″][vc_column_text css_animation=”left-to-right”] Story I created a new simple project with a custom edit text without any logic (it just extends EditText). The code is the following: CustomEditText.java package com.example.customedittextcursor; import android.content.Context; import android.util.AttributeSet; import android.widget.EditText; /** * @author Diana PraÈ›a * Date: […]

, , , ,
Solutions

Android onActivityResult not called from fragment

Today I had an issue with onActivityResult() method which was not called inside a fragment. My first impulse was to move the method inside the activity that hosts the fragment, and that’s what I actually did. So, I ran my app in debug mode and when I saw that the breakpoint stopped in the onActivityResult method from

, ,
Tutorial

Android: How to reset score from Google Play Games leaderboards

[vc_row parallax_image=”” boxed_columns=”” section=”” vertical_centering=”” background=”” img=”” parallax=”” video=”” bg_type=”” parallax_style=”” bg_image_new=”” layer_image=”” bg_image_repeat=”” bg_image_size=”” bg_cstm_size=”” bg_img_attach=”” parallax_sense=”” bg_image_posiiton=”” animation_direction=”” animation_repeat=”” video_url=”” video_url_2=”” u_video_url=”” video_opts=”” video_poster=”” u_start_time=”” u_stop_time=”” viewport_vdo=”” enable_controls=”” bg_override=”” disable_on_mobile_img_parallax=”” parallax_content=”parallax_content_value” parallax_content_sense=”” fadeout_row=”” fadeout_start_effect=”” enable_overlay=”” overlay_color=”” overlay_pattern=”” overlay_pattern_opacity=”” overlay_pattern_size=”” overlay_pattern_attachment=”” multi_color_overlay=”” multi_color_overlay_opacity=”” seperator_enable=”” seperator_type=”” seperator_position=”” seperator_shape_size=”” seperator_svg_height=”” seperator_shape_background=”” seperator_shape_border=”” seperator_shape_border_color=”” seperator_shape_border_width=”” icon_type=”” icon=””

, , , , , , ,
Privacy Policy

Android Studio Tip #6 – Multiple Cursors

I have heard before about this “ability” of Android Studio of having multiple cursors active at the same time, but I haven’t found it very useful until today. You can see what I am talking about in the gif below: Press ALT + SHIFT and left click on the mouse and select the position of

, , ,
Privacy Policy

Android Studio Tip #5 – Autocomplete “for” statement

When you want to write a for statement most of you guys (or at least me :P) start to write character by character “for (int i = 0; i < list.size(); i++)”. Well Android Studio makes this easier for us and we can avoid writing that much by using a combination of 2 keys: CTRL

, , ,
Uncategorized

Android Studio Tip #4 – Automatic Negation

Sometimes, (in fact, many times :P) you have to negate boolean expressions, and in order to do that, you write the expression and after that you go back to the beginning to add “!”, am I right? :D Well, you can avoid doing this, by pressing the “!” instead of Enter when you use autocomplete. Just

, , , ,
Uncategorized

Android Studio Tip #3 – Open Class At Specific Line

Did you know that you can open a class at a specific line? This is very useful if you do code reviews and you want to open a specific class to a specific line. Well, Android Studio let us to achieve this by using: To search for a file press: CTRL + SHIFT + N (

, , ,
Solutions

Android Debugging is not working

PROBLEM You add breakpoints and you cannot debug your code. CAUSE The problem might be that you have ProGuard enabled in the gradle file. buildTypes { release { minifyEnabled true } SOLUTION So if you set minifyEnabled to FALSE, your debugging should start working. If this is not the issue, then you can try restart AndroidStudio

, , ,
Solutions

Genymotion Get Google Play Services

If you need Google Play Services, you must know that Genymotion doesn’t have Google Play by default, at least for the moment. So you have to download a zip file containing it from here. For Android 5.1 Download from here For Android 5.0 Download from here For Android 4.4.4 Download from here For Android 4.3 Download from

,
Uncategorized

Android Studio Tip #2 – Extract Instance Variable

You might need to “convert” a local variable into an instance variable. Well, you can do this very easy with Android Studio. So, in order to extract an instance variable (field) you can do this by using the following shortcut: CTRL + ALT + F (on Windows) or Cmd + ALT + F (on Mac OS)

, , , ,
Uncategorized

Android Studio Tip #1 – Extract Constants

If you have hardcoded strings that should be extracted into constants, you can do that in at least 2 ways: the hard way the EASY way The hard way  is to write yourself the constant and then replace it in the entire code where the string is used. And the EASY way  is to use the power

, , , ,
Tutorial

Android Floating Action Button (FAB) Tutorial

TUTORIAL DEPRECATED Use this tutorial instead: Floating Action Button New In this tutorial I will show you how to add a Floating Action Button aka FAB, for pre Lollipop versions and for Lollipop. For pre versions it will be just a simple round button with shadow and click effect, but for Android 5.0 we will use

, , , ,
Solutions

Android ShareActionProvider Change Text Color

I think I spent 2 days in order to find a way of changing the text color of the ShareActionProvider. There are some posts on the internet but none worked for me. So I started to try myself each and every item attribute from @style/Theme.AppCompat.Light.DarkActionBar. After a while I found the items I was looking for: <item name=”textAppearanceLargePopupMenu”>

, ,
Scroll to Top