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.

Create Image From View Screen Android


WebView_webview = (WebView)findViewById(R.id.webViewMapa);
// _webview.loadUrl( ... some your page

Bitmap b = Bitmap.createBitmap(_webview.getWidth()/2, _webview.getHeight(), Bitmap.Config.ARGB_8888);
// you can to draw on bitmap
Canvas c = new Canvas(b);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
//paint.setShadowLayer(5.f, 0, 5.f, 0xFF000000);
_webview.draw(c); // put into canvas content of view like image
c.drawLine(70, 0, 150, 350, paint);// draw some line
//Rect oval = new Rect(0, 0, 100, 100);
//c.drawArc(oval, 0, 180, false, paint);

// you can show bitmap in other view

397LW NO topic_id


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


Timer simple TimerTask Java Android example | timer-simple-timertask-java-android-example

TimerTask with updating of TextView here

package cz.okhelp.timer;

import java.util.Timer;
import java.util.TimerTask;

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

public class TimerActivity extends Activity {
TextView hTextView;
    public void onCreate(Bundle savedInstanceState) {
        hTextView = (TextView)findViewById(R.id.idTextView);
        MyTimerTask myTask = new MyTimerTask();
        Timer myTimer = new Timer();
//        public void schedule (TimerTask task, long delay, long period) 
//        Schedule a task for repeated fixed-delay execution after a specific delay.
//        Parameters
//        task  the task to schedule. 
//        delay  amount of time in milliseconds before first execution. 
//        period  amount of time in milliseconds between subsequent executions. 

        myTimer.schedule(myTask, 3000, 1500);        
class MyTimerTask extends TimerTask {
	  public void run() {
		  // ERROR
		 // how update TextView in link below  
                 // //android.okhelp.cz/timer-task-timertask-run-cancel-android-example/



How to set different locales in android | how-to-set-different-locales-in-android

- create new folder with values in resources folder in project with extension your language code
For example:
My language is Czech (cs)
I have to create the folder values-cs in res folder

// for locale English is default
<?xml version="1.0" encoding="utf-8"?>

    <string name="app_name">App English default</string>
    <string name="action_settings">Settings English default</string>
    <string name="hello_world">Hello world</string>


// for locale Czech (cs)
<?xml version="1.0" encoding="utf-8"?>

    <string name="app_name">Aplikace česky cs</string>
    <string name="action_settings">Nastavení česky</string>
    <string name="hello_world">Ahoj světe!</string>


// for locale English US (r is region)

<?xml version="1.0" encoding="utf-8"?>

    <string name="app_name">App English Us locale</string>
    <string name="action_settings">Settings English Us locale</string>
    <string name="hello_world">Hello world from USA :)</string>


Into every values folder put strings.xml file
Translate every string from values folder into your locale.
If user selected your locale in device settings, application selects a string from the correct (proper) folder.

R.java not generated - Android project in Eclipse issue | r-java-not-generating-android-project-in-eclipse-issue

If You create new xml file with prefix _ , for example _style.xml and You to clean project (Project->Clean), than package in folder project\gen will deleted with R.java class and new R.java not be created.

For to solving this problem You have to rename file without prefix _ as style.xml or name what You need and rebuild project.

If some ID cannot be resolved or is not a field get error occurence
You have to delete import android.R; in Activity.class if was inserted,
when this error is displayed.

Eclipse - Workspace in use or cannot be created chose a different one | eclipse-workspace-in-use-or-cannot-be-created-chose-a-different-one

Open your workspace folder and subfolder .metadata:

Delete .lock file

Statistics usability of mobile phones with Android - September 2011 | statistics-usability-of-mobile-phones-with-android-september-2011

(Our software)

1Samsung Galaxy S213.8% (1,232)
2Samsung Galaxy S8.5% (762)
3Samsung Galaxy Tab7.4% (659)
4Samsung Galaxy Mini5.4% (483)
5Samsung Galaxy S4.0% (356)
6HTC Desire HD3.8% (341)
7Samsung Galaxy Ace3.8% (339)
8HTC Wildfire3.2% (286)
9Samsung Galaxy Fit3.1% (274)
10SEMC Xperia X102.1% (190)

Editace: 2013-07-08 07:38:23
Počet článků v kategorii: 397

11 Share