Recepty, články, nápady, programování. Dříve dum-zahrada, finance, internet a know-how.okhelp.cz Pro lepší výsledky hledání používejte i diakritiku.

App have transparent menu Android


If the app have transparent menu and you do not want this,
try delete @style/AppTheme in application tag in AndroidManifest.xml
and try run module - project. If menu is not transparent , maybe it caused

        android:theme="@style/AppTheme" // delete this row - run app - try menu

Or try set values\styles.xml into basic Theme


        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    <style name="AppBaseTheme" parent="android:Theme.Black">
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->


397LW NO topic_id


Další témata ....(Topics)


How to set different locales in android | how-to-set-different-locales-in-android

- create new folder with values in resources folder in project with extension your language code
For example:
My language is Czech (cs)
I have to create the folder values-cs in res folder

// for locale English is default
<?xml version="1.0" encoding="utf-8"?>

    <string name="app_name">App English default</string>
    <string name="action_settings">Settings English default</string>
    <string name="hello_world">Hello world</string>


// for locale Czech (cs)
<?xml version="1.0" encoding="utf-8"?>

    <string name="app_name">Aplikace česky cs</string>
    <string name="action_settings">Nastavení česky</string>
    <string name="hello_world">Ahoj světe!</string>


// for locale English US (r is region)

<?xml version="1.0" encoding="utf-8"?>

    <string name="app_name">App English Us locale</string>
    <string name="action_settings">Settings English Us locale</string>
    <string name="hello_world">Hello world from USA :)</string>


Into every values folder put strings.xml file
Translate every string from values folder into your locale.
If user selected your locale in device settings, application selects a string from the correct (proper) folder.

EditText hint not show | edittext-hint-not-show

Try this solution - into xml file add row to EditText tag:



Leap year date time Java Android example | leap-year-date-time-java-android-example

GregorianCalendar cal = new GregorianCalendar(); Boolean b = cal.isLeapYear(2012); // true, Android example.

public class MainActivity extends Activity {
TextView txtV;
	Context cntx;
    public void onCreate(Bundle savedInstanceState) {
        txtV = (TextView)findViewById(R.id.idLabel);
        cntx = this;
        StringBuilder strBuild = new StringBuilder();
         GregorianCalendar cal = new GregorianCalendar();
         Boolean b = cal.isLeapYear(2012); // true
         strBuild.append("Is leap year 2012? " + b + "

"); b = cal.isLeapYear(2014); // false strBuild.append("Is leap year 2014? " + b + "
"); txtV.setText(strBuild); } }

Android Studio Gradle Download Link | android-studio-gradle-download-link

I You use offline work for better building speed of project or for other purpose

Offline work:
File - Settings - Gradle
- select Use local gradle distribution
- select path Gradle home:
- check Offline work

Call requires permission which may be rejected by user | call-requires-permission-which-may-be-rejected-by-user

Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with `checkPermission`) or explicitly handle a potential `SecurityException`

try {
// your code for example: 
//  LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);         
//  Criteria criteria = new Criteria();
//        provider = locationManager.getBestProvider(criteria, false);
//  locationManager.requestLocationUpdates(provider, 400, 1, this);
        } catch (SecurityException e) {

Editace: 2016-03-19 09:06:14
Počet článků v kategorii: 397

11 Share