WebView.loadData utf-8 encoding Android
Try this solution:
String DATA = "Html text....bla bla bla. Hellou world! čšřžěéá";
String HEADERHTML =
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">"
+"<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8">"
+"</head> <body>";
String FOOTERHTML = "</body></html>";
WebView mWebView.loadData(HEADERHTML+DATA+FOOTERHTML,"text/html; charset=UTF-8",null);
396LW NO topic_id
AD
Další témata ....(Topics)
// in strings.xml
<string name="myStringWithTags"><![CDATA[<b>some text..</b> other tags ...]]></string>
<string name="myStringWithPattern"><![CDATA[<b>%s</b> other tags ...]]></string>
// in Activity.class
String sHtmlText = this.getApplicationContext().getString(R.string.myStringTags);
sHtmlText = this.getApplicationContext().getString(R.string.myStringWithPattern,"replace %s with this text");
Basic shortcuts for Android Emulator.
More about Android Emulator
Emulated Device Key | Keyboard Key |
---|---|
Home | HOME |
Menu (left softkey) | F2 or Page-up button |
Star (right softkey) | Shift-F2 or Page Down |
Back | ESC |
Call/dial button | F3 |
Hangup/end call button | F4 |
Search | F5 |
Power button | F7 |
Audio volume up button | KEYPAD_PLUS, Ctrl-5 |
Audio volume down button | KEYPAD_MINUS, Ctrl-F6 |
Camera button | Ctrl-KEYPAD_5, Ctrl-F3 |
Switch to previous layout orientation (for example, portrait, landscape) | KEYPAD_7, Ctrl-F11 |
Switch to next layout orientation (for example, portrait, landscape) | KEYPAD_9, Ctrl-F12 |
Toggle cell networking on/off | F8 |
Toggle code profiling | F9 (only with -trace startup option) |
Toggle fullscreen mode | Alt-Enter |
Toggle trackball mode | F6 |
Enter trackball mode temporarily (while key is pressed) | Delete |
DPad left/up/right/down | KEYPAD_4/8/6/2 |
DPad center click | KEYPAD_5 |
Onion alpha increase/decrease | KEYPAD_MULTIPLY(*) / KEYPAD_DIVIDE(/) |
More about Android Emulator
If Android emulator freezes at startup, try create new virtual device with smaller memory and cpu usage, or select older version of Android, or buy new pc with higher performance.
- open AVD MANAGER
- press Create Virtual Device
- select Device with small memory usage (e.g. 480x800 of resolution) - Next
- check - Show downloadable ....
- Download - lower version of system Android, select, press - Next
- check data, Show Advanced Settings, check Use host... and press Finish
SeekBar setOnSeekBarChangeListener Example. Change TextView font size by SeekBar Example.
TextView mTextView01 = (TextView)findViewById(R.id.textView01);
SeekBar mSeekBarTexSize = (SeekBar)findViewById(R.id.seekBarTextSize);
mSeekBarTexSize.setMax(100);
mSeekBarTexSize.setProgress(25);
mSeekBarTexSize.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
mTextView01.setTextSize((float)progress);
}
public void onStartTrackingTouch(SeekBar seekBar) {}
public void onStopTrackingTouch(SeekBar seekBar) {}
});
TimerTask with updating of TextView here
//android.okhelp.cz/asynctask-example-android-with-progressbar/
//android.okhelp.cz/timer-task-timertask-run-cancel-android-example/
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;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
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
hTextView.setText("Impossible");
// how update TextView in link below
// //android.okhelp.cz/timer-task-timertask-run-cancel-android-example/
System.out.println("");
}
}
}
//android.okhelp.cz/asynctask-example-android-with-progressbar/
//android.okhelp.cz/timer-task-timertask-run-cancel-android-example/
Editace: 2014-02-03 08:27:46
Počet článků v kategorii: 396
Url:webview-loaddata-utf-8-encoding-android