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 to Add Home Screen Widgets on Your Android Phone


Long press by finger on screen
From dialogue select Widgets
Select your widget
Put your widget on the screen

Video tutorial - to add home screen widgets - Android 2.1

397LW NO topic_id


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


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,

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

Eclipse quick help

How to capture screenshot of emulator window - Android sample | how-to-capture-screenshot-of-emulator-window-android-sample

When Eclipse and the emulator runs.
To access the DDMS perspective, go to Window > Open Perspective > DDMS. If DDMS does not appear, go to Window > Open Perspective > Other ... and select DDMS.

Open Devices TAB. Window -> Show view -> Devices

From Devices TAB select Screen Capture
Android emlator screen capture by eclipse

Eclipse "id cannot be resolved or is not a field” error Android | eclipse-id-cannot-be-resolved-or-is-not-a-field-error-android

"id cannot be resolved or is not a field” error
If you copy project to workspace or some code from other project you can get this error.

Try remove or add import your R file:

import com.example.app.R

Check xml files.
Clean project by menu Project-Clean

Maybe you have to create new project end copy old source files to new project folders.

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;
    public void onCreate(Bundle savedInstanceState) {
        hTextView = (TextView)findViewById(R.id.idTextView);
        hButton = (Button)findViewById(R.id.idButton);
        hButtonStop = (Button)findViewById(R.id.idButtonStop);

    } // end onCreate

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

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

    	mTimerTask = new TimerTask() {
    	        public void run() {
    	                handler.post(new Runnable() {
    	                        public void run() {
                                        // 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(){

    	      hTextView.setText("Timer canceled: " + nCounter);

    	      Log.d("TIMER", "timer canceled");


Eclipse Graphical Editor does not display a xml source code - error bug | eclipse-graphical-editor-does-not-display-code-error-bug

Try this solutions:
1.) Save xml file
2.) Close tab with xml file
3.) Reopen xml file

1.) Open from menu Window->Android SDK Manager
2.) Select available updates (Tools, SDK etc.)
3.) Install updates

1.) Open from menu Help->Check for Updates
2.) Install available plugins what You need
3.) Restart Eclipse

Editace: 2013-12-09 10:09:15
Počet článků v kategorii: 397

11 Share