addPreferencesFromResource Deprecated Android Code Warning
Put extends PreferenceFragment API level 11 instead PreferenceActivity
public class SettingsActivity extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
}
}
// or insert suppresswarning
public class SettingsActivity extends PreferenceActivity {
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
}
}
396LW NO topic_id
AD
Další témata ....(Topics)
Go to Eclipse menu:
Window -> Preferences -> Java -> Code Style -> Formatter
Press NEW profile or EDIT if have you some profile.
Setup your settings.
Save settings.
Window -> Preferences -> Java -> Code Style -> Formatter
Press NEW profile or EDIT if have you some profile.
Setup your settings.
Save settings.
BufferedWriter, FileWriter, write, close MODE_APPEND Java and Android example
Write to file Android example
Write to file Java example
Write to file Android example
try {
String MYFILE = "my_file";
String strText = "My text";
// MODE_APPEND, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE
// create new file or rewrite existing
FileOutputStream fos = openFileOutput(MYFILE, getApplicationContext().MODE_PRIVATE);
// append to file
FileOutputStream fos = openFileOutput(MYFILE, getApplicationContext().MODE_APPEND);
fos.write(strText.getBytes());
fos.close();
} catch (IOException e) {
e.toString();
}
Write to file Java example
try {
// new file
BufferedWriter out = new BufferedWriter(
new FileWriter("outfilename"));
// append text
BufferedWriter out = new BufferedWriter(new FileWriter("outfilename", true));
out.write("some text");
out.close();
} catch (IOException e) {
e.toString();
}
Try before html tags put space and check if every tag is closed b - /b.
For example:
"java.lang.IndexOutOfBoundsException
at android.graphics.Paint.getTextRunAdvances(Paint.java:1731)
at android.graphics.Paint.getTextRunAdvances(Paint.java:1704)
at android.text.MeasuredText.addStyleRun(MeasuredText.java:164)
at android.text.MeasuredText.addStyleRun(MeasuredText.java:204)
at android.text.StaticLayout.generate(StaticLayout.java:281)
at android.text.StaticLayout.(StaticLayout.java:140)
at android.text.StaticLayout.(StaticLayout.java:80)
at android.text.StaticLayout.(StaticLayout.java:59)
at android.widget.TextView.makeSingleLayout(TextView.java:5901)
at android.widget.TextView.makeNewLayout(TextView.java:5741)
at android.widget.TextView.onMeasure(TextView.java:6098)
at android.view.View.measure(View.java:15172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
at android.view.View.measure(View.java:15172)
at android.widget.ListView.setupChild(ListView.java:1847)
at android.widget.ListView.makeAndAddView(ListView.java:1772)
at android.widget.ListView.fillDown(ListView.java:672)
at android.widget.ListView.fillSpecific(ListView.java:1330)
at android.widget.ListView.layoutChildren(ListView.java:1600)
at android.widget.AbsListView.onLayout(AbsListView.java:2102)
at android.view.View.layout(View.java:13754)
at android.view.ViewGroup.layout(ViewGroup.java:4362)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1649)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1507)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1420)
at android.view.View.layout(View.java:13754)
at android.view.ViewGroup.layout(ViewGroup.java:4362)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:13754)
at android.view.ViewGroup.layout(ViewGroup.java:4362)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1649)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1507)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1420)
at android.view.View.layout(View.java:13754)
at android.view.ViewGroup.layout(ViewGroup.java:4362)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:13754)
at android.view.ViewGroup.layout(ViewGroup.java:4362)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1866)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1687)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4212)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
"
For example:
My text (<i>some text</i>) blah blah...
Change to:
My text ( <i>some text</i>) blah blah...
"java.lang.IndexOutOfBoundsException
at android.graphics.Paint.getTextRunAdvances(Paint.java:1731)
at android.graphics.Paint.getTextRunAdvances(Paint.java:1704)
at android.text.MeasuredText.addStyleRun(MeasuredText.java:164)
at android.text.MeasuredText.addStyleRun(MeasuredText.java:204)
at android.text.StaticLayout.generate(StaticLayout.java:281)
at android.text.StaticLayout.
at android.text.StaticLayout.
at android.text.StaticLayout.
at android.widget.TextView.makeSingleLayout(TextView.java:5901)
at android.widget.TextView.makeNewLayout(TextView.java:5741)
at android.widget.TextView.onMeasure(TextView.java:6098)
at android.view.View.measure(View.java:15172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
at android.view.View.measure(View.java:15172)
at android.widget.ListView.setupChild(ListView.java:1847)
at android.widget.ListView.makeAndAddView(ListView.java:1772)
at android.widget.ListView.fillDown(ListView.java:672)
at android.widget.ListView.fillSpecific(ListView.java:1330)
at android.widget.ListView.layoutChildren(ListView.java:1600)
at android.widget.AbsListView.onLayout(AbsListView.java:2102)
at android.view.View.layout(View.java:13754)
at android.view.ViewGroup.layout(ViewGroup.java:4362)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1649)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1507)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1420)
at android.view.View.layout(View.java:13754)
at android.view.ViewGroup.layout(ViewGroup.java:4362)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:13754)
at android.view.ViewGroup.layout(ViewGroup.java:4362)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1649)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1507)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1420)
at android.view.View.layout(View.java:13754)
at android.view.ViewGroup.layout(ViewGroup.java:4362)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:13754)
at android.view.ViewGroup.layout(ViewGroup.java:4362)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1866)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1687)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4212)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
"
How set rounded corners and own styles ActivityMy.java
\res\drawable\back_button_answer.xml
Button btn.setBackgroundResource(R.drawable.back_button_answer);
\res\drawable\back_button_answer.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="//schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners android:radius="10dip" />
<!-- background -->
<gradient
android:startColor="#D6D7D6"
android:centerColor="#E2E2E2"
android:centerY="0.75"
android:endColor="#D6D7D6"
android:angle="270"
/>
<stroke android:width="2dip" android:color="#fff"/>
</shape>
Špičkový smartphone od Samsungu.
Technické parametry Samsung i9300 Galaxy S III
Rozměry a hmotnost: 137 x 71 x 9 mm, 133 gramů
Datové funkce: GPS modul, WiFi, Bluetooth, NFC, GPRS, EDGE, HSCSD, Hardwarový modem, Infraport
Sítě: pásma GSM 850, 900, 1 800, 1 900 MHz pásma WCDMA (3G) 850, 900, 1 900, 2 100 MHz
Displej: HD Super AMOLED diplej o velikosti 1280x720 4,8 palců
Procesor: čtyřjádrový procesor 1.4 GHz
Uživatelská paměť: 16 MB
paměť RAM 1 024 MB
Operační systém: Android 4.0 ICS
Hudba: MP3
Video: HD rozlišení
Fotoaparát: 8 Mpix
Navigace:
Baterie: Li-Pol, pohotovostní doba 390 hodin
Cena: cca 14.500 korun / léto 2012
Samsung i9300 Galaxy S III obrázek
Technické parametry Samsung i9300 Galaxy S III
Rozměry a hmotnost: 137 x 71 x 9 mm, 133 gramů
Datové funkce: GPS modul, WiFi, Bluetooth, NFC, GPRS, EDGE, HSCSD, Hardwarový modem, Infraport
Sítě: pásma GSM 850, 900, 1 800, 1 900 MHz pásma WCDMA (3G) 850, 900, 1 900, 2 100 MHz
Displej: HD Super AMOLED diplej o velikosti 1280x720 4,8 palců
Procesor: čtyřjádrový procesor 1.4 GHz
Uživatelská paměť: 16 MB
paměť RAM 1 024 MB
Operační systém: Android 4.0 ICS
Hudba: MP3
Video: HD rozlišení
Fotoaparát: 8 Mpix
Navigace:
Baterie: Li-Pol, pohotovostní doba 390 hodin
Cena: cca 14.500 korun / léto 2012
Samsung i9300 Galaxy S III obrázek
Editace: 2014-02-15 20:15:37
Počet článků v kategorii: 396
Url:addpreferencesfromresource-deprecated-android-code-warning