Okhelp.cz

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


AD MOB

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

 <application
        android:allowBackup="true"
        android:icon="@drawable/dicts_ico"
        android:label="@string/app_name" 
        android:theme="@style/AppTheme" // delete this row - run app - try menu
 >


Or try set values\styles.xml into basic Theme

<resources>

    <!--
        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.
        -->
    </style>

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

</resources>


397LW NO topic_id




AD

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


107

Memory usage of application in Android sample code | memory-usage-of-application-in-android-sample-code



public class MainClass extends Activity {
ActivityManager activityManager; 
MemoryInfo memoryInfo; 
final String TAG = "MemInfo";


@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

         activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
         memoryInfo = new ActivityManager.MemoryInfo();

        activityManager.getMemoryInfo(memoryInfo);
 
    	           Log.i(TAG, " memoryInfo.availMem " + memoryInfo.availMem);
    	           Log.i(TAG, " memoryInfo.lowMemory " + memoryInfo.lowMemory);
    	           Log.i(TAG, " memoryInfo.threshold " + memoryInfo.threshold);

  Toast.makeText(getApplicationContext(),  String.valueOf( memoryInfo.availMem), Toast.LENGTH_LONG)
		.show();

    } // end onCreate
}
336

Android emulator freezes at startup create new virtual device | android-emulator-freezes-at-startup-create-new-virtual-device


If Android emulator freezes at startup, try create new virtual device with smaller memory and cpu usage, or select older version of Android, or buy new pc with higher performance.

  1. open AVD MANAGER

  2. press Create Virtual Device

  3. select Device with small memory usage (e.g. 480x800 of resolution) - Next

  4. check - Show downloadable ....

  5. Download - lower version of system Android, select, press - Next

  6. check data, Show Advanced Settings, check Use host... and press Finish


android-studio-create-virtual-device-emulator
88

Map TreeMap key value pair sort by value Java Android example | map-treemap-key-value-pair-sort-by-value-java-android-example


Map TreeMap sorted by value Java Android example.

MainClass.java


import java.util.Comparator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;

public class MainClass {
	public static void main(String[] arg) {

		// english;germany dictionary
		String[] arrayOfString = { "one;eine", "two;zwei", "three;drei",
				"four;vier" };

		Map<String, String> map = new TreeMap<String, String>();

		for (String s : arrayOfString) {
			String[] array = s.split(";");
			String sKey = "", sValue = "";
			if (array.length > 1) {
				sKey = array[0];
				sValue = array[1];
				map.put(sKey, sValue);
			}
		}
		for (Entry<String, String> entry: mapSortedByValues(map)) {
		    System.out.println(entry.getKey() + " = " + entry.getValue());
		}
	}

	static <K, V extends Comparable<? super V>> SortedSet<Map.Entry<K, V>> mapSortedByValues(
			Map<K, V> map) {
		SortedSet<Map.Entry<K, V>> sortedSetOfEntries = new TreeSet<Map.Entry<K, V>>(
				new Comparator<Map.Entry<K, V>>() {
					@Override
					public int compare(Map.Entry<K, V> entry_1, Map.Entry<K, V> entry_2) {
						int res = entry_1.getValue().compareTo(entry_2.getValue());
						return res != 0 ? res : 1; 
						// return entry_1.getValue().compareTo(entry_2.getValue());							
					}
				});
		sortedSetOfEntries.addAll(map.entrySet());
		return sortedSetOfEntries;
	}
}
/*
three = drei
one = eine
four = vier
two = zwei
 */

327

Links too close together Mobile friendly page | links-too-close-together-mobile-friendly-page


Try set bigger line-height of links and font size for example:


/*in css*/
.links{
line-height: 48px;
font-size: 20px;
background-color: rgb(255,204,0);
}

/* in html page set class of link*/
<a class="links" href="m.mydomen.com/mypage.html">Blah blah mypage</a>

// or in css for all links on page
a {
line-height: 48px;
font-size: 20px;
}

/*html page*/
<a href="m.mydomen.com/mypage.html">Blah blah mypage</a>

92

How add Android code templates to Eclipse | how-add-android-code-templates-to-eclipse


If you have to type frequently the same code you can create templates which can be activate via autocomplete with Ctrl + Space.

For example lets assume setOnClickListener body.

To create a template for this select the menu Window->Preferences and Open Java -> Editor -> Templates

Create new Android template in Eclipse



Type name of template in Eclipse s editor and pres Ctrl+Space


[caption id="attachment_1114" align="alignleft" width="300" caption="Eclipse-show-template-proposals"]eclipse-show-template-proposals[/caption]


Select your template from intellisense help and press Enter or double click on selected item.


[caption id="attachment_1116" align="alignleft" width="300" caption="Eclipse - select your template"][/caption]



	mIdButtonHome.setOnClickListener(new View.OnClickListener() {
		public void onClick(View v) {
			Intent browserIntent = new Intent(Intent.ACTION_VIEW,
					Uri.parse("//android.okhelp.cz/category/software/"));
			startActivity(browserIntent);
		}
	});






Quick help in Eclipse editor: select keyword and press Ctrl+1

Eclipse quick help


Editace: 2016-03-19 09:06:14
Počet článků v kategorii: 397
Url:app-have-transparent-menu-android

AD
11 Share
Share
Tweet