Category: Android

Greendao test migrate database onUpgrade Google Play Store

Greendao test migrate database onUpgrade Google Play Store

To simulate migration database or trigger onUpgrade() on DevHelper in GreenDao, the step will be: 1. Use simulate update app like in Google Play Store Follow this : http://www.yodiaditya.com/android-simulate-update-application-google-play-store/ 2. ALWAYS UPDATE SCHEMA VERSION GREENDAO yes, i put this capitalized because it’s very important! For instance: 12345greendao {     schemaVersion 5     daoPackage …

+ Read More

Android simulate update application Google Play Store

Android simulate update application Google Play Store

To simulate update android application from Google Play Store, we can use adb and Android Studio. Here is the step by step: A. Generate APK 1. Go to Android Studio -> Build -> Builds (APK) 2. Switch mode to Project 3. Copy app/build/outputs/apk/debug/app-debug.apk to any folder B. Deploy with adb 1. Go to the folder …

+ Read More

Solve margin Searchview expandable and Toolbar Android

Solve margin Searchview expandable and Toolbar Android

This margin / padding issue often occured when searchview widget have left space that push another icons in toolbars. To solve this issues, we remove padding left in toolbar and adjust the TitleMarginStart margin accordingly. This is example of the codes:

Android editext textwatcher thousand separator no lag or slow

Android editext textwatcher thousand separator no lag or slow

I’m a bit curious that editext using textwatcher to manipulate into thousand comma separator perform really slow after lolipop version. Mostly the tutorial shared the solution is remove and add listener on TextWatcher and make manipulation directly to EditText. Performance issue is the issue from this approach. Here are snippet for edittext thousand separator with …

+ Read More

Tutorial Implementation Google Cloud Messaging (GCM) with Django

Tutorial Implementation Google Cloud Messaging (GCM) with Django

Setup GCM for Android Client and Django in Server require efforts to know how it’s works. Here are simple steps to setup the newest GCM (Google Cloud Messaging) in Android. To understand about GCM, the flow is : 1. Create a Google APIs GCM project, which generates SENDER_ID and API_KEY for server implementation. 2. An …

+ Read More

Install Recovery Heimdall clockwok into Samsung S3 G9300 in Ubuntu

Install Recovery Heimdall clockwok into Samsung S3 G9300 in Ubuntu

1. Download and install heimdall https://github.com/Benjamin-Dobell/Heimdall/downloads (Heimdall and Suite) 2. Install android adb 123sudo add-apt-repository ppa:phablet-team/tools && sudo apt-get update sudo apt-get install android-tools-adb android-tools-fastboot sudo dpkg –add-architecture i386 3. Download recovery 1wget -c http://download2.clockworkmod.com/recoveries/recovery-clockwork-6.0.4.6-i9300.img 4. Start Download Mode Plug Samsung S3 into your laptop and execute console 12adb reboot download sudo heimdall flash –recovery …

+ Read More

java.lang.SecurityException: Permission Denial: Intent android

java.lang.SecurityException: Permission Denial: Intent android

When i deploy into android devices, suddenly it’s not running automatically and i got this: 1java.lang.SecurityException: Permission Denial: Intent To solve, please add “android:exported=”true” and make sure no duplicate activity in your Manifest.xml. 123456<application         android:allowBackup="true"         android:icon="@drawable/ic_launcher"         android:label="@string/app_name"         android:theme="@style/CustomActionBarTheme"   …

+ Read More

Generate facebook android key hash

Generate facebook android key hash

Here is snippet to generate facebook android key hash : 1keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64

Set imageview background using drawable based on API 7 / 8

Set imageview background using drawable based on API 7 / 8

Here is snippet to set background in Imageview that support API 7 / 8 : 12345678910111213141516171819/**      * Set background image      *      * @param imagePath      */     @TargetApi(Build.VERSION_CODES.JELLY_BEAN)       @SuppressWarnings("deprecation")     private void setBackgroundImage(final String imagePath) {         Bitmap bm = …

+ Read More

Solve detail fragment lost after orientation in Android

Solve detail fragment lost after orientation in Android

It’s takes me about few hours to debug why the detail fragment lost after i change the orientation. Here is the case, home activity (with navigation drawer) will load fragment A. When people click item in fragment A, it will going to fragment B. 1Home Activity -> Fragment A -> Fragment B When, we change …

+ Read More

SwipeRefreshLayout and StaggeredGridView Android

SwipeRefreshLayout and StaggeredGridView Android

Merging between SwipeRefreshLayout and StaggeredGridView is not easy. To make it works together, we need to do few things. Here is the way : 1. Set listener and topindex variable 123456private int topIndex = 0; public class HomeFragment extends Fragment implements AbsListView.OnScrollListener,         AbsListView.OnItemClickListener, OnRefreshListener { } Fyi, we need topIndex for …

+ Read More

Solve launching android on Device very slow

Solve launching android on Device very slow

Today, i found the culprit why launching / deploy app into devices takes about 5 – 10 seconds. Apparently it’s because external folder. Here is the fixes : 1. Right click on your project 2. Select Build Path -> Configure Build Path 3. Go to Libraries tab 4. Remove source attachment Problem solved! 😀

Solve burger icon not showed in actionbar

Solve burger icon not showed in actionbar

Usually, we have burger icon in top left of actionbar. When it’s disappear, it probably because several issue. First thing, make sure Fragment have : 12((ActionBarActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); ((ActionBarActivity)getActivity()).getSupportActionBar().setTitle(menu_title);

Remove element object from List / ArrayList in Java

Remove element object from List / ArrayList in Java

Removing object / element in List / ArrayList in Java a bit tricky. For instance, if we have ArrayList(); then we can remove the element using : 1listItem.remove(new Integer(index)); But this way not working for listItem contains objects. To remove, we should pass object itself. 1listItem.remove(Object);

Spinner white text color white background android solution

Spinner white text color white background android solution

Here is how to solve spinner showing white text color on white background. Make sure to use “this” or “getActivity()” in arrayAdapter. Here is correct example : 1234 ArrayAdapter<String> adapterCity = new ArrayAdapter<String>(getActivity(),                     android.R.layout.simple_spinner_item, listCity);             adapterCity.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);         …

+ Read More

Solve action bar null pointer exception ActionBarImplICS notitle

Solve action bar null pointer exception ActionBarImplICS notitle

When we using actionbar appcompat, we should enable window title applications. But, it’s ugly to have window title in our apps. Here is the solution : Update your Android SupportLibrary and use 123getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,                 WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_home);

Android SDK requires Android Developer Toolkit version 22.6.1 or above

Android SDK requires Android Developer Toolkit version 22.6.1 or above

Here is solution to solve Eclipse have problem after updating Android SDK : Android SDK requires Android Developer Toolkit version 22.6.1 or above 1. Go to Help -> Install New Software 2. Add https://dl-ssl.google.com/eclipse/plugin/4.2 3. Tick on Developer Tools 4. Install and Restart your ADT

ListView showing only one results, do you use Scrollview ?

ListView showing only one results, do you use Scrollview ?

Please remember not to use ListView under ScrollView since both view have “scroll” features. When you put ListView under ScrollView, the ListView will only showing one results. You can use dynamic adding view / programmatically into ScrollView to make “List” format. Some example : 12345678910111213141516String[] statusConsultation = {"First data", "Second data", "Third data"}; LinearLayout statusLayout …

+ Read More

Find SHA1 for Android Studio for Google API

Find SHA1 for Android Studio for Google API

If we’re using ADT (Eclipse based), then we can find SHA1 keystore from Preferences. In Android Studio (IntelIJ), we couldn’t do that. We only can do manually : 1. Open your DOS 2. Go to “C:/Users/” 3. Go to .android 4. Use keytool to retrieve keystore details by : 1keytool -list -v -keystore debug.keystore And …

+ Read More

Solve adb devices empty or Android not detected in Eclipse

Solve adb devices empty or Android not detected in Eclipse

If ADB not showing your devices or Eclipse not showing your Android in running devices, probably you’re missing the USB driver. Please install the usb driver for your android devices. For samsung, you can search google for “Samsung_USB_Driver_for_Mobile_Phones_v1.5.14.0”

Dex Loader Unable to execute dex : Multiple dex files define Android

Dex Loader Unable to execute dex : Multiple dex files define Android

When we using 3rd party library, sometimes we got this error while running our app, eg: 1Dex Loader Unable to execute dex : Multiple dex files define Lcom/google/gson/JsonSerializer; This happen when in our app, we have libs folder with gson jar (eg: gson-2.2.4.jar). In sametime, our Google Play Service library already have Gson as well. …

+ Read More

Implement SSL in Android

Implement SSL in Android

Please follow this links for implement SSL in Android : http://stackoverflow.com/questions/1217141/self-signed-ssl-acceptance-android#answer-15531475 faced this issue yesterday, while migrating our company’s RESTful API to HTTPS, but using self-signed SSL certs. I’ve looking everywhere but all the “correct” marked answers I’ve found consisted on disabling certificate validation, clearly overriding all the sense of SSL. I finally came to …

+ Read More

NumberPicker looping Android

NumberPicker looping Android

Here is to make NumberPicker looping in Android : 1234567final NumberPicker np1 = (NumberPicker) view                 .findViewById(R.id.numberPicker1); final String[] nums1 = generateHour(0); np1.setMaxValue(23); np1.setMinValue(0); np1.setWrapSelectorWheel(true); np1.setDisplayedValues(nums1);

Keep highlight selected item in Gridview Android

Keep highlight selected item in Gridview Android

Gridview have option to modify it’s selector (listSelector). When we click on item in Gridview, we saw blink blue and then dissapear after we release it. To make it stay, all we need just declare it at “android:listSelector” in GridView XML. For instance : 1234567891011121314<?xml version="1.0" encoding="utf-8"?> <GridView xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/calendar_gridview"     android:layout_width="match_parent" …

+ Read More