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.

SimpleCursorAdapter deprecated

Constructor SimpleCursorAdapter is deprecated.
If using api 11 and above, you can try add last parameter 0.

Cursor cursor = managedQuery(...........,,,,);
// Specify the columns we want to display in the result
            String[] from = new String[] { KEY_WORD,
                                           KEY_DEFINITION };

            // Specify the corresponding layout elements where we want the columns to go
            int[] to = new int[] { R.id.word,
                                   R.id.definition };
// deprecated 
 SimpleCursorAdapter words =
            new SimpleCursorAdapter(this,
                    R.layout.result, cursor, from, to);
// working
 SimpleCursorAdapter words =
            new SimpleCursorAdapter(this,
                    R.layout.result, cursor, from, to, 0); // to, 0!!!!

//working in Fragment
SimpleCursorAdapter  mAdapter = new SimpleCursorAdapter(getActivity(),
                android.R.layout.simple_list_item_2, null,
                new String[] { "name", "age" }, // cursor parameters
                new int[] { android.R.id.text1, android.R.id.text2 }, 0);

397LW NO topic_id

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


Unchecked call to add(E) as a member of raw type java.util.List | unchecked-call-to-adde-as-a-member-of-raw-type-java-util-list

// warnning
private List list = new ArrayList();

// ok /put type of added object
private List<String> list = new ArrayList<String>();

Statistics usability of mobile phones with Android – October 2011 | statistics-usability-of-mobile-phones-with-android-%e2%80%93-october-2011

Table of usability phones with Android: (Our software)

October 2011 September 2011

Samsung Galaxy S2 10,90%
Samsung Galaxy S 8,10%
Samsung Galaxy Tab 7,00%
Samsung Galaxy Mini 6,20%
HTC Desire HD 4,10%
Samsung Galaxy Ace 4,10%
Samsung Galaxy S 4,00%
Samsung Galaxy Fit 3,30%
HTC Wildfire 3,20%
SEMC Xperia X10 2,20%

Samsung Galaxy S213.8%
Samsung Galaxy S8.5%
Samsung Galaxy Tab7.4%
Samsung Galaxy Mini5.4%
Samsung Galaxy S4.0%
HTC Desire HD3.8%
Samsung Galaxy Ace3.8%
HTC Wildfire3.2%
Samsung Galaxy Fit3.1%
SEMC Xperia X102.1%

Graph of usability Smartphone with Android - October 2011:

Samsung Galaxy S2 vs iPhone4 - video

Samsung Galaxy S2 vs iPhone4 - browsing, gaming, apps, performance, browser, fast, against, navigation, Sygic, apk, Android, iOS


Preferences settings save open read write application Android example | preferences-settings-save-open-red-application-android-example

Android app setup preferences, settings, open, read, write, onStop(), onPause(), getSharedPreferences(), SharedPreferences.Editor getInt(), getBoolean(), getString() , putInt(), putString(), putBoolean() example source code.

import android.content.SharedPreferences;

public class MainClass extends Activity {
  public static final String PREFERENCES_NAME = "MyPrefsFile";
  String myNewString;
  int myNewInt;
  Boolean myNewBool;

    public void onCreate(Bundle savedInstanceState) {
        // read old settings if exist
      SharedPreferences settings = getSharedPreferences(PREFERENCES_NAME, 0);
     String sDefault = "Hello!";
      String sStringFromPrefFile = settings.getString("myString", sDefault); // new text  or default Hello!
      int nDefaultIndex = 2; //
      int nIndexFromPrefFile = settings.getInt("myInt", nDefaultIndex); // 4 or default 2
      Boolean bDefault = false;
      Boolean bFromPrefFile = settings.getBoolean("silentMode", bDefault); // true or default false
        // new settings will saved in onStop or onPause
        myNewString = "new text";
        myNewInt = 4;
        myNewBool = true;

    protected void onPause() {
        Toast.makeText(getApplicationContext(), "onPause "
        		, Toast.LENGTH_SHORT).show();

    protected void onStop() {
    /**save settings*/	
    public void savePreferences(){
    	try {
    		SharedPreferences settings = getSharedPreferences(PREFERENCES_NAME, 0);
    		SharedPreferences.Editor editor = settings.edit();
    		editor.putString("myString", myNewString);
     		editor.putInt("nMyInt", myNewInt);
    		editor.putBoolean("silentMode", myNewBool); // 
    	} catch (Exception e) {
    		// TODO Auto-generated catch block

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.

HTC One S | htc-one-s-nejlepsi-smartphone

Nejlepší Smartphone jaro 2012.
Best of Smartphone spring 2012.

Brand HTC
Model (codename) One S
Price - (Cena, včetně DPH) 13000
Display size in Inch (v palcích) 4.3
Display-resolution (rozlišení) 960x540
Dotek-typ multi-touch capacitive
CPU typ MSM8260A
CPU MHz 1500
CPU core 2
L2 cache
GPU Adreno 225
NenaMark2 Benchmark
Battery mAh 1650 mAh, 10.5 hours of talk time and 13.2 days of stand-by time
Foto MPx 8
Autofocus AF
Video HD záznam videa, 1920×1080 (1080p HD) @ 30 frame/s - 3GP, .3G2, MP4, WMV, AVI
Official Android ICS Android 4.0 Ice Cream Sandwich, HTC Sense 4.0 overlay
CyanogenMod support
Network HSPA/WCDMA: • Europe/Asia: 850/900/2100 MHz GSM/GPRS/EDGE: • 850/900/1800/1900 MHz
Connectivity 3.5 mm stereo audio jack Bluetooth with aptX™ enabled (Bluetooth® 4.0) Wi-Fi®: IEEE 802.11b/g/n DLNA® for wirelessly streaming media from the phone to a compatible TV or computer micro-USB 2.0 (5-pin) port with mobile high-definition video link (MHL) for USB or HDMI connection (Special cable required for HDMI connection.)

Pdf file

htc one s smartphone

Video - záznam a kvalita videa HTC One S

Editace Jana Žákovská : 2015-11-04 19:51:00
Počet článků v kategorii: 397