Do not hardcode /data/ use Context.getFilesDir().getPath()
// warning
private static String DB_PATH = "/data/data/cz.okhelp.german_czech_phrases/databases/";
// OK
public DataBaseHelper(Context context) {
super(context, DB_NAME, null, 1);
this.myContext = context;
// OK
DB_PATH = context.getFilesDir().getParentFile().getPath()
+ "/databases/";
}
396LW NO topic_id
AD
Další témata ....(Topics)
Example from SDK C:\Program Files\Android\android-sdk-windows\samples\android-10\ApiDemos\src\com\example\android\apis\text\Link.java
Source: //developer.android.com/resources/browser.html?tag=sample
License: //www.apache.org/licenses/LICENSE-2.0
1.) Automatically linkifies using android:autoLink="all"
2.) Link text by setMovementMethod
3.) Link as html code using Html.fromHtml()
4.) Link string by SpannableString
Source: //developer.android.com/resources/browser.html?tag=sample
License: //www.apache.org/licenses/LICENSE-2.0
1.) Automatically linkifies using android:autoLink="all"
// res/values/strings.xml
<string name="link_text_auto"><b>text1:</b> This is some text. In
this text are some things that are actionable. For instance,
you can click on //www.google.com and it will launch the
web browser. You can click on google.com too. And, if you
click on (415) 555-1212 it should dial the phone.
</string>
// main.xml
<!-- text1 automatically linkifies things like URLs and phone numbers. -->
<TextView xmlns:android="//schemas.android.com/apk/res/android"
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoLink="all"
android:text="@string/link_text_auto"
/>
2.) Link text by setMovementMethod
// MainActivity.java onCreate
/*Be warned that if you want a TextView with a key listener or movement method not to be focusable, or if you want a TextView without a key listener or movement method to be focusable, you must call setFocusable(boolean) again after calling this to get the focusability back the way you want it. */
TextView t2 = (TextView) findViewById(R.id.text2);
t2.setMovementMethod(LinkMovementMethod.getInstance());
// main.xml
<!-- text2 uses a string resource containing explicit <a> tags to
specify links. -->
<TextView xmlns:android="//schemas.android.com/apk/res/android"
android:id="@+id/text2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/link_text_manual"
/>
//strings.xml
<string name="link_text_manual"><b>text2:</b> This is some other
text, with a <a href="//www.google.com">link</a> specified
via an <a> tag. Use a "tel:" URL
to <a href="tel:4155551212">dial a phone number</a>.
</string>
3.) Link as html code using Html.fromHtml()
// MainActivity.java onCreate
TextView t3 = (TextView) findViewById(R.id.text3);
t3.setText(
Html.fromHtml(
"<b>text3:</b> Text with a " +
"<a href="//www.google.com">link</a> " +
"created in the Java source code using HTML."));
t3.setMovementMethod(LinkMovementMethod.getInstance());
4.) Link string by SpannableString
SpannableString ss = new SpannableString(
"text4: Click here to dial the phone.");
ss.setSpan(new StyleSpan(Typeface.BOLD), 0, 6,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
ss.setSpan(new URLSpan("tel:4155551212"), 13, 17,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
TextView t4 = (TextView) findViewById(R.id.text4);
t4.setText(ss);
t4.setMovementMethod(LinkMovementMethod.getInstance());
- create div with class with name e.g. circle
- create in styleSheet.css class circle
html code
<div class="circle" id="">3</div>
css code
.circle {
border-radius: 50%;
width: 50px;
height: 50px;
background: yellow;
position: absolute;
display: block;
border: 6px solid blue;
font-size: 50px;
text-align: center;
}
3
Brand | Samsung |
Model (codename) | i9250 Galaxy Nexus |
Cena, včetně DPH | 9000 |
Veikost Displaye v palcích | 4.65 |
Display-resolution | 1280x720 |
Dotek-typ | kapacitní |
CPU typ | |
CPU MHz | 1200 |
CPU core | 2 |
L2 cache | |
RAM | 1 GB |
ROM | 16 - 32 GB |
GPU | TI OMAP 4460 1,2 GHz dual-core |
NenaMark2 Benchmark | |
GPU-GLBenchmark | |
Baterie mAh | 1750 |
Foto MPx | 5 |
Autofocus | yes |
Video | 480p - 30 frames/s |
Official Android ICS | Android 4.0 Ice Cream Sandwich |
CyanogenMod support | |
Dotek-prstů-max | |
Display-ppi | |
Display-retina | |
Network | GSM&EDGE: 850 / 900 / 1.800 / 1.900 |
Connectivity | |
Pozn. |
samsung-i9250-galaxy-nexus image
String[] sAr = new String[] {"one","two","three"};
List<String> wordList = Arrays.asList(sAr);
Collections.shuffle( wordList);
String[]myShuffledArray = wordList.toArray(new String[wordList.size()]);
Try this code:
final String ERROR = "my error message....";
private class DownloadWebPageTask extends AsyncTask<String, Void, String> {
// some code and method ..... see AsyncTask
@Override
protected String doInBackground(String... urls) {
URL urlL = null;
try {
urlL = new URL(url);//"//chmi.cz..../"
HttpURLConnection urlConnection = null;
try {
urlConnection = (HttpURLConnection) urlL.openConnection();
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
response = readStream(in);
return response;
} catch (IOException e) {
//throw new RuntimeException(e);
} finally {
if(urlConnection != null)
urlConnection.disconnect();
return ERROR;
}
} catch (MalformedURLException e) {
e.printStackTrace();
return ERROR;
}
}
return response;
}
private String readStream(InputStream is) {
try {
ByteArrayOutputStream bo = new ByteArrayOutputStream();
int i = is.read();
while(i != -1) {
bo.write(i);
i = is.read();
}
return bo.toString();
} catch (IOException e) {
return "";
}
}
Editace: 2013-12-12 14:09:55
Počet článků v kategorii: 396
Url:do-not-hardcode-data-use-context-getfilesdir-getpath