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.

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:

adb kill-server && adb start-server

Save restartADB.bat file.
If you want restart adb.exe server, run restartADB.bat by double click on icon.

Next example:

  1. Open Total Commander

  2. Open folder with adb.exe usually in
    c:\Program Files\Android\android-sdk-windows\platform-tools\

  3. 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"]adb-restart-server-android-emulator[/caption]

Try restart ADB if this or similar errors:
Emulator] emulator: emulator window was out of view and was recentred

397LW NO topic_id


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


Set Drawable programmatically Android example | set-drawable-programmatically-android-example

// start_dark.png is stored in path	/package_name/res/drawable/start_dark.png
Drawable dw = getApplicationContext().getResources().getDrawable(R.drawable.start_dark);
Button hButtonStart = (Button)findViewById(R.id.buttonStart);
hButtonStart.setCompoundDrawablesWithIntrinsicBounds(dw, null, null, null);


No USB devices or running detected | no-usb-devices-or-running-detected


  • is sett debug mode on device?

  • enabled debugging over USB?

  • is device right connected?

  • have you downloaded and instaled drivers for your device on PC?

  • For Windows //developer.android.com/sdk/win-usb.html

  • try disconnect and connect USB cable

  • try do restart Android Studio


Open Save UTF-8 File To String Java Android Code | open-save-utf-8-file-to-string-java-android-code

String sFileContent = readFile("myfile.txt",StandardCharsets.UTF_8);

	static String readFile(String path, Charset encoding) 
		  throws IOException 
		  byte[] encoded = Files.readAllBytes(Paths.get(path));
		  return encoding.decode(ByteBuffer.wrap(encoded)).toString();

// write file
String sOut = "text blah hello world etc.";
	static void writeToFile(String sB,String name) {
		String folder = ("c:\\folder\\");
		File f = new File(folder+ name);
		BufferedWriter writer = null;
			writer = new BufferedWriter( new OutputStreamWriter(
                           new FileOutputStream( folder+name),"UTF-8"));
			writer.write( sB);

				if ( writer != null)
					writer.close( );


Android Error: Converting to string: TypedValue{t=0x10/d=0xe a=-1} | android-error-converting-to-string-typedvaluet0x10d0xe-a-1

Converting to string: TypedValue{t=0x10/d=0xe a=-1}

14 // error
"18" // ok


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: 2014-02-15 20:47:20
Počet článků v kategorii: 397

11 Share