Popular questions for this item

Are you going to support Eclipse IDE?

We are not. Android Studio is the future. Eclipse IDE is deprecated for Android development. It does not support Gradle which we use for managing and building apps. Android Studio is a new Android development environment based on IntelliJ IDEA. It provides new features and improvements over Eclipse ADT and is the official Android IDE. Android Studio is much more powerful and easier to use. There is no reason to use Eclipse anymore.

I get error “You need to use a different version code for your APK because you already have one with version code XYZ” when uploading to Google Play. How can I fix it?

If you are releasing a new update in Google Play, you have to increment the version code. Open mobile/build.gradle file and try to increment VERSION_PATCH value. Version code is calculated this way: VERSION_MAJOR*10000000 + VERSION_MINOR*100000 + VERSION_PATCH*1000 + VERSION_BUILD. If it does not help, try to increment another version constant.

Are you able to add a splash screen?

Our priority is to create top quality products. We are strictly following Android Design Guidelines. Using splash screens is against Android Design Guidelines and it is one of top ten UX anti-patterns.

Splash screen is the UI pattern used on iOS platform. It is not recommended to use it on Android. Moreover there is no API in SDK which would support this. Splash screen is slowing down start of the app and blocks the users. See Splash Screens Are Evil, Don’t Use Them! for more info.

That’s why we are not going to add splash screen. Thanks for understanding.

How to show information about use of cookies and other forms of local storage?

European laws require that digital publishers give users information about their use of cookies and other forms of local storage. In many cases these laws also require that consent be obtained. See www.cookiechoices.org for more info.

Open MainActivity.java in activity package. Find onStart() method and add following piece of code at the end of the method: showCookiesDialog();
Finally add following code somewhere inside the MainActivity object: private void showCookiesDialog() { final String FIRST_RUN = "first_run"; final SharedPreferences preferences = getSharedPreferences("cookies", MODE_PRIVATE); if(preferences.getBoolean(FIRST_RUN, true)) { new AlertDialog.Builder(this) .setTitle("Cookies") .setMessage("We use device identifiers to personalise content and ads, to provide social media features and to analyse our traffic. We also share such identifiers and other information from your device with our social media, advertising and analytics partners.\n\nBy using our services, you agree to our use of device identifiers.") .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { preferences.edit().putBoolean(FIRST_RUN, false).commit(); } }).show(); } }

How can I add another buttons to the action bar menu?

You can modify menu in the action bar editing res/menu/fragment_main.xml file. Then you have to invoke some action if the menu button is pressed. You can do that in onOptionsItemSelected() method inside MainFragment.java. See this article for more info: https://developer.android.com/training/basics/actionbar/adding-buttons.html

How can I enable zoom controls in the webview?

Open MainFragment.java in fragment package. Find setupView() method and replace “mWebView.getSettings().setBuiltInZoomControls(false);” by “mWebView.getSettings().setBuiltInZoomControls(true);”.

If you want to hide zoom buttons, add this piece of code below: if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mWebView.getSettings().setDisplayZoomControls(false); }

How can I set web page scale? The website is too big so users have to zoom out.

Open MainFragment.java in fragment package. Find setupView() method and add following piece of code at the end of the method (argument is the scale in percent): mWebView.setInitialScale(50); or you can also try this code: mWebView.getSettings().setUseWideViewPort(true); mWebView.getSettings().setLoadWithOverviewMode(true);

How can I change user agent string?

Open MainFragment.java in fragment package. Find setupView() method and add following piece of code at the end of the method:
mWebView.getSettings().setUserAgentString("My User Agent String");

How should I handle Facebook login? Blank page is shown after signing in.

Open MainFragment.java in fragment package. Find onPageFinished method and add following piece of code under this line “showActionBarProgress(false);”: if(url.contains("facebook.com") && url.contains("dialog/oauth") && (url.contains("&refsrc") || url.contains("&domain"))) { Uri uri = Uri.parse(url); String callbackUrl = uri.getQueryParameter("refsrc"); if(callbackUrl==null) callbackUrl = "http://" + uri.getQueryParameter("domain"); view.loadUrl(callbackUrl); // callback URL }

How can I force RTL (right to left) mode?

RTL (right to left) was introduced in Android 4.2. See Native RTL support in Android 4.2 for more info.

If you need to force your entire layout to be RTL including the action bar, open MainActivity.java in activity package. Find onCreate method and add following piece of code at the end of the method: if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL); }

Show more