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.

No USB devices or running detected


AD MOB

Check

  • 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


397LW NO topic_id




AD

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


242

Replace graphic accent diacritic Java Function | replace-graphic-accent-java-function


Replace diacritic marks: Á Č Ď É Ě Í Ň Ó Ř Š Ť Ú Ů Ý Ž
á č ď é ě í ň ó ř š ť ú ů ý ž


public String replaceDiacritic (String inputStr) {
	
	Map<String, String> replacements = new LinkedHashMap<String,String>() {{
		//Velká
		put("Á","A");
		put("Č","C");
		put("Ď","D");
		put("É","E");
		put("Ě","E");
		put("Í","I");
		put("Ň","N");
		put("Ó","O");
		put("Ř","R");
		put("Š","S");
		put("Ť","T");
		put("Ú","U");
		put("Ů","U");
		put("Ý","Y");
		put("Ž","Z");
		//Malá  "," ");
		put("á","a");
		put("č","c");
		put("ď","d");
		put("é","e");
		put("ě","e");
		put("í","i");
		put("ň","n");
		put("ó","o");
		put("ř","r");
		put("š","s");
		put("ť","t");
		put("ú","u");
		put("ů","u");
		put("ý","y");
		put("ž","z");
		}
	};
	for(Map.Entry<String, String> entry : replacements.entrySet()) {
          inputStr =  inputStr.replaceAll(entry.getKey(), entry.getValue());
         }	
	return inputStr;
}
	
23

Hide keyboard Android example | hide-keyboard-android-example


Use this code for example in some method or function

// public Object getSystemService (String name)
// Return the handle to a system-level service by name.
// The class of the returned object varies by the requested name.
InputMethodManager inputMethodManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
//public boolean hideSoftInputFromWindow (IBinder windowToken, int flags)
//EditText myEdit = (EditText)findViewById(R.id.idEditText);
inputMethodManager .hideSoftInputFromWindow(myEdit.getWindowToken(), 0);


31

Start Activity from ListView item click Android example | start-activity-from-listview-item-click-android-example


How start certain Activity if user clicked to ListView item
Start Activity from list – launches other activities from list - latest variant!!!!


public class Main extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        try {
        setContentView(R.layout.main);
        
			ListView mlistView = (ListView) findViewById(R.id.idListView);
			mlistView.setAdapter(new ArrayAdapter<String>(this,
			        android.R.layout.simple_list_item_1, 
			        new String[] {"Game", "Help", "Home site"}));
    
        mlistView.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
              // When clicked, show a toast with the TextView text Game, Help, Home
              Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
                  Toast.LENGTH_SHORT).show();
              String sText = ((TextView) view).getText().toString();
              Intent intent = null;
              if(sText.equals("Game"))
              intent = new Intent(getBaseContext(),
						Game.class);
              //else if(sText.equals("Help")) ..........

              if(intent != null)
				startActivity(intent);              
            }
          });
        } catch (Exception e) {
        	// TODO Auto-generated catch block
        	e.printStackTrace();
        }
    
    }
}



Game class Game.java game.xml
You have to add class Game to AndroidManifest.xml

        <activity android:name=".Game" android:label="GameLabel">
        </activity>





package cz.okhelp.listview;

import android.app.Activity;
import android.os.Bundle;

public class Game extends Activity{
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        // you have to create game.xml 
        setContentView(R.layout.game);
    }
}




43

No title bar Android application without titlebar style Theme NoTitleBar Android example | no-title-bar-android-application-without-titlebar-style-theme-notitlebar-android-example


Set in AndroidManifest.xml android:theme="@android:style/Theme.NoTitleBar" AndroidManifest.xml example source code.
AndroidManifest.xml


<manifest xmlns:android="//schemas.android.com/apk/res/android"
    package="com.myexample.without_titlebar">
    <application android:label="My app">
      <activity android:name="NoTitleBar"
        android:theme="@android:style/Theme.NoTitleBar"
        android:screenOrientation="portrait"
        android:configChanges="keyboardHidden|orientation">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

302

Layout not found on Android 2.1 | layout-not-found-on-android-2-1


If I create own folder layout-w320dp with Eclipse Android 4.4
layout was correctly loaded.
If I trying this application on tablet with Android 2.1 application crashed.


layout-not-loaded-android-2-1


Editace: 2016-02-29 16:53:45
Počet článků v kategorii: 397
Url:no-usb-devices-or-running-detected

AD
11 Share
Share
Tweet