How quickly restart adb.exe ADB server Android emulator example
Create file restartADB.bat in folder
c:\Program Files\Android\android-sdk-windows\platform-tools\
Write into restartADB.bat this code:
Save restartADB.bat file.
If you want restart adb.exe server, run restartADB.bat by double click on icon.
Next example:
[caption id="attachment_778" align="alignleft" width="300" caption="ADB server restart by command line"][/caption]
Try restart ADB if this or similar errors:
Emulator] emulator: emulator window was out of view and was recentred
c:\Program Files\Android\android-sdk-windows\platform-tools\
Write into restartADB.bat this code:
adb kill-server && adb start-server
pause
Save restartADB.bat file.
If you want restart adb.exe server, run restartADB.bat by double click on icon.
Next example:
- Open Total Commander
- Open folder with adb.exe usually in
c:\Program Files\Android\android-sdk-windows\platform-tools\ - Put into command line command: adb kill-server && adb start-server and press Enter
[caption id="attachment_778" align="alignleft" width="300" caption="ADB server restart by command line"][/caption]
Try restart ADB if this or similar errors:
Emulator] emulator: emulator window was out of view and was recentred
396LW NO topic_id
AD
Další témata ....(Topics)
Hashtable find value by key Java Android basic example.
import java.util.Hashtable;
public class MainClass {
public static void main(String[] arg) {
// english;germany dictionary
String[] arrayOfString = { "one;eine", "two;zwei", "three;drei" };
Hashtable hashTable = new Hashtable();
for(String s: arrayOfString){
String[] array = s.split(";");
String sKey ="", sValue="";
if(array.length > 1){
sKey = array[0]; sValue = array[1];
hashTable.put(sKey, sValue);
}
}
// check if key exists
if( hashTable.containsKey("two")){
System.out.print("two = " + hashTable.get("two"));
}
}
}
/*
two = zwei
*/
Map TreeMap key value pair, Map sort by key, Iterator for Map Java Android example.
MainClass.java
MainClass.java
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
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);
}
}
List sortedByKeys=new ArrayList(map.keySet());
Collections.sort(sortedByKeys);
// iterate map
Set references = map.keySet();
Iterator it = references.iterator();
while (it.hasNext()) {
String key = (String) it.next();
String value = map.get(key);
System.out.println(key + " = " + value);
}
// or other example how iterate map
TreeSet<String> keys = new TreeSet<String>(map.keySet());
for (String key : keys) {
String value = map.get(key);
System.out.println(key + " = " + value);
}
// check if key exists
// if( map.containsKey("two")){
// System.out.print("two = " + map.get("two"));
// }
}
}
/*
four = vier
one = eine
three = drei
two = zwei
*/
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
Or try set values\styles.xml into basic Theme
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>
public class MainActivity extends Activity {
// //www.apache.org/licenses/LICENSE-2.0
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new SampleView(this));
}
private static class SampleView extends View {
private Rect mRect;
private GradientDrawable mDrawable;
public SampleView(Context context) {
super(context);
setFocusable(true);
mRect = new Rect(0, 0, 220, 120);
/* GradientDrawable.Orientation BL_TR draw the gradient from the bottom-left to the top-right
BOTTOM_TOP draw the gradient from the bottom to the top
BR_TL draw the gradient from the bottom-right to the top-left
LEFT_RIGHT draw the gradient from the left to the right
RIGHT_LEFT draw the gradient from the right to the left
TL_BR draw the gradient from the top-left to the bottom-right
TOP_BOTTOM draw the gradient from the top to the bottom
TR_BL draw the gradient from the top-right to the bottom-left
*/
mDrawable = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT,
new int[] { 0xFFFF0000, 0xFF00FF00,
0xFF0000FF });
mDrawable.setShape(GradientDrawable.RECTANGLE);
mDrawable.setGradientRadius((float)(Math.sqrt(2) * 60));
}
static void setCornerRadius(GradientDrawable drawable, float r0,
float r1, float r2, float r3) {
/* setCornerRadii
Specify radii for each of the 4 corners. For each corner,
the array contains 2 values, [X_radius, Y_radius].
The corners are ordered top-left, top-right, bottom-right,
bottom-left
*/
drawable.setCornerRadii(new float[] { r0, r0, r1, r1,
r2, r2, r3, r3 });
}
@Override protected void onDraw(Canvas canvas) {
mDrawable.setBounds(mRect);
float r = 35;
canvas.save();
canvas.translate(10, 10);
mDrawable.setGradientType(GradientDrawable.LINEAR_GRADIENT);
setCornerRadius(mDrawable, r, r, 0, 0);
mDrawable.draw(canvas);
canvas.restore();
canvas.translate(0, mRect.height() + 10);
canvas.save();
canvas.translate(10, 10);
mDrawable.setGradientType(GradientDrawable.RADIAL_GRADIENT);
setCornerRadius(mDrawable, 0, 0, r, r);
mDrawable.draw(canvas);
canvas.restore();
canvas.translate(0, mRect.height() + 10);
canvas.save();
canvas.translate(10, 10);
mDrawable.setGradientType(GradientDrawable.SWEEP_GRADIENT);
setCornerRadius(mDrawable, 0, r, r, 0);
mDrawable.draw(canvas);
canvas.restore();
}
}
}
Locale lc = Locale.getDefault(); // default now locale on device
String sCountry = lc.getCountry(); // CZ
lc = new Locale("fr","FR"); //FRANCE .. Locale(language, country);
String sCountry2 = lc.getDisplayCountry(); // Francie
Locale locale = Locale.GERMAN;
String sCountry3 = locale.getDisplayCountry(); // ""
Locale locale = Locale.GERMAN;
DateFormat formatter = new SimpleDateFormat("HH:mm:ss zzzz", locale);
String s = formatter.format(new Date());//13:40:39 GMT+00:00
// array of locales
Locale[] locales = { new Locale("fr", "FR"), new Locale("de", "DE"),
new Locale("en", "US") };
Locale locale = Locale.US;
// for date
DateFormat dateFormatterEurope = DateFormat.getDateInstance(DateFormat.DEFAULT,
Locale.GERMANY);
Calendar myCalendar = Calendar.getInstance();
String sDate = dateFormatterEurope.format(myCalendar.getTime());
final byte[] langBytes = locale.getLanguage().getBytes(Charsets.US_ASCII);
// UTF-8 most widely used text format for to properly display of text
final Charset utfEncoding = Charsets.UTF_8;
String text = "ěščřžýáíéůú";
final byte[] textBytes = text.getBytes(utfEncoding);
// other Locale
CANADA
CANADA_FRENCH
CHINA
CHINESE
ENGLISH
FRANCE
FRENCH
GERMAN
GERMANY
ITALIAN
ITALY
JAPAN
JAPANESE
KOREA
KOREAN
PRC // Locale constant for zh_CN.
ROOT // Locale constant for the root locale.
SIMPLIFIED_CHINESE
TAIWAN
TRADITIONAL_CHINESE Locale constant for zh_TW.
UK
US
Editace: 2014-02-15 20:47:20
Počet článků v kategorii: 396
Url:how-quickly-restart-adb-exe-adb-server-android-emulator-example