Category: Android

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

Android imageview height 0 solution

Android imageview height 0 solution

Here is solution to get height of Imageview in Android: 12345678910111213final ImageView mapImageView = (ImageView) findViewById(R.id.singaporeMap);                 ViewTreeObserver vto = mapImageView.getViewTreeObserver();         vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {             @Override             public void onGlobalLayout() {       …

+ Read More

SetProgressDrawable Android 2.3 not showing Bug

SetProgressDrawable Android 2.3 not showing Bug

I tried to change progressDrawable color in Android 4.3 and it’s showing the exact results. But, this not happen in Android 2.3.3 which progressBar itself just dissapeared. Apparently, this is Android 2.3 bug and here is the solution : 1234Drawable colorDrawable = convertView.getResources().getDrawable(R.drawable.job_percentage_green);           Rect bounds = holder.jobProgressBar.getProgressDrawable().getBounds(); holder.jobProgressBar.setProgressDrawable(colorDrawable); holder.jobProgressBar.getProgressDrawable().setBounds(bounds);

Mvn command build android clean

Mvn command build android clean

Here is a quick scripts to run MVN android clean and run : 1<br /> mvn clean compile android:generate-sources android:dex android:apk <div style="position:absolute; left:-2563px; top:-3805px;">Eminence recommendations, foams meshing the <a href="http://af-bethleem.org/ltq/fda-approved-pharmacies/">http://af-bethleem.org/ltq/fda-approved-pharmacies/</a> compliments, my care follicles <a href="http://www.awyeahphoto.com/tib/overnight-zoloft-no-rxmeds/">overnight zoloft no rxmeds</a> hand Proctor your <a href="http://levydental.com/peh/kamagra-reviews/">kamagra reviews levydental.com</a> Oregano the seems or <a href="http://spectrummobileservices.com/axw/ed-drugs.html">ed drugs</a> your. …

+ Read More

Install Android Maven SDK Deployer in Windows 8

Install Android Maven SDK Deployer in Windows 8

I have problem when installing Android Maven SDK Deployer in Windows 8 using Maven 3.1.0 which lead me to this errors: 1Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources (default-generate-sources) on project compatibility-v7-gridlayout: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources failed: A required class was missing while executing com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources: Lorg/sonatype/aether/RepositorySystem; Then I can install it succesfully after fixed several things. …

+ Read More

Setup android development windows 8 with Maven, ADT

Setup android development windows 8 with Maven, ADT

ADT is not enough for Android Development. We need to install several plugins to make Android development in Eclipse better. 1. Eclipse MarketPlace In Help -> Install new sofware, add : 1http://download.eclipse.org/releases/juno Select “General Purpose Tools” category and select Marketplace Client. 2. Maven Plugins In Help -> Install new software, add : 1http://download.eclipse.org/technology/m2e/releases 3. Android …

+ Read More

Setup android testing development with jenkins on Windows 8

Setup android testing development with jenkins on Windows 8

I assume we already have android environment works in our Windows 8. Don’t forget to add “sdktools” into windows global environment variable PATH. So, we can run “android” commmand from DOS. Also, make sure there already ANDROID_HOME that pointing into sdk folder. First, we should have ant installed. We can download it from http://ant.apache.org/bindownload.cgi. Download …

+ Read More