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)


24

Sqlite create database and table with BAT file for Android | sqlite-create-database-and-table-with-bat-file


Sqlite3 create database and table with load.bat file and fill data to table example.


  1. Create folder for your project: my_sqlite_project

  2. Open folder and create file load.bat and paste to load.bat this text and save to project folder:


    sqlite3 my_database.s3db < load_text.sql
    pause



  3. Create load_text.sql file and paste this text and save to project folder:

    CREATE TABLE [android_metadata] (
    [locale] TEXT
    );




    CREATE TABLE [my_table] (
    [_id] int NULL,
    [word] VARCHAR(255) NULL,
    [description] VARCHAR(255) NULL




    .separator ";"
    .import text_file.txt my_table


  4. Create text_file.txt and paste this text and save it as UTF-8:

    1;word1;my first word
    2;word2; my second word



  5. Download sqlite3.exe and put to project folder.

  6. Run BAT file load.bat and read text instruction from console

  7. If database created you can open and edit this with sqlite database explorer

  8. Copy database to Asses Android project folder

  9. If you want using this database in Android application on device, you have to copy this database to folder on device /data/data/com.MyPackage/databases/









69

Timer task TimerTask run cancel Android example | timer-task-timertask-run-cancel-android-example


Update TextView from TimerTask, Handler, schedule, run, cancel TimerTask, Android example

public class TimerActivity extends Activity {
	TimerTask mTimerTask;
	final Handler handler = new Handler();
	Timer t = new Timer();	
TextView hTextView;
TableRow hTableRow;
Button hButton, hButtonStop;


private int nCounter = 0;
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        hTextView = (TextView)findViewById(R.id.idTextView);
        hButton = (Button)findViewById(R.id.idButton);
        hButton.setOnClickListener(mButtonStartListener);
        hButtonStop = (Button)findViewById(R.id.idButtonStop);
        hButtonStop.setOnClickListener(mButtonStopListener);

         
        
    } // end onCreate

View.OnClickListener mButtonStartListener = new OnClickListener() {
	public void onClick(View v) {
		doTimerTask();
    }
};



	
	View.OnClickListener mButtonStopListener = new OnClickListener() {
    	public void onClick(View v) {
    		stopTask();
    		
    	}
    };
    
    
    public void doTimerTask(){

    	mTimerTask = new TimerTask() {
    	        public void run() {
    	                handler.post(new Runnable() {
    	                        public void run() {
    	                        	nCounter++;
                                        // update TextView
    	                        	hTextView.setText("Timer: " + nCounter);

    	                        	Log.d("TIMER", "TimerTask run");
    	                        }
    	               });
    	        }};

            // public void schedule (TimerTask task, long delay, long period) 
    	    t.schedule(mTimerTask, 500, 3000);  // 

    	 }

    	  public void stopTask(){

    	   if(mTimerTask!=null){
    	      hTextView.setText("Timer canceled: " + nCounter);

    	      Log.d("TIMER", "timer canceled");
    	      mTimerTask.cancel();
    	 }
    
    }    
}


296

On orientation changed view button textview not visible Android | on-orientation-changed-view-button-textview-not-visible-android


Try add to AndroidManifest.xml configChanges for your Activity
android:configChanges="keyboardHidden|orientation|screenSize"


 <activity android:name=".MainActivity"
                  android:label="@string/app_name"
                  android:configChanges="keyboardHidden|orientation|screenSize"
                  >
125

Get SensorManager PowerManager WindowManager Display Android example | get-sensormanager-powermanager-windowmanager-display-android-example



    private SensorManager mSensorManager;
    private PowerManager mPowerManager;
    private WindowManager mWindowManager;
    private Display mDisplay;

// onCreate
   @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

       // Get an instance of the SensorManager
        mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);

        // Get an instance of the PowerManager
        mPowerManager = (PowerManager) getSystemService(POWER_SERVICE);

        // Get an instance of the WindowManager
        mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
        mDisplay = mWindowManager.getDefaultDisplay();

        setContentView(R.layout.main); // main.xml or your xml file name

}

47

How to make a quick start the android emulator | how-to-make-a-quick-start-the-android-emulator


Very very quick start of Android Emulator from Eclipse.

  1. Go to Eclipse s menu Window -> Android SDK and AVD Manager

  2. Select Virtual devices

  3. Select check box Snapshot: Enabled

  4. Press Edit AVD button.



If will closed Android Emulator all data will saved on disk.
If will reopen Android Emulator, configuration and data will read from disk.


[caption id="attachment_768" align="alignleft" width="300" caption="android-emulator-enable-quick-start"][/caption]


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