Okhelp.cz

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.

addPreferencesFromResource Deprecated Android Code Warning


AD MOB

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);
  }
}


397LW NO topic_id




AD

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


271

How to add or remove widgets home screen android 4 | how-to-add-or-remove-widgets-home-screen-android-4


Video tutorial
How to add or remove widgets home screen Android 4.


78

Goto labeled statement in Java example | goto-labeled-statement-in-java-example


Goto in for cycle Java example source code.
MainClass.java

public class MainClass {
	public static void main(String[] arg) {
		String[] arrayOfString = {"nothing", "Hello", "people"
				, "bye-bye", "hello", "world!", "end" };
		
	    OuterLoop: for (int i = 0;i<6; i++) {
	        for (int j = 0; j < arrayOfString.length; j++) {
	        	if (arrayOfString[j].equals("world!")) {
	            continue OuterLoop; // as goto from Csharp, or C/C++
	          }
	          System.out.println(arrayOfString[j]);
	          System.out.println(i);
	          if (i == 1) {
	        	  System.out.println("break");
	        	  
	        	  break OuterLoop;
	          }
	        }
	      }
		
	}
}
/*
nothing
0
Hello
0
people
0
bye-bye
0
hello
0
nothing
1
break
*/
338

Linkify TextView clickable phone number url adress | linkify-textview-clickable-phone-number-url-adress


android:autoLink="all"

 <!-- text1 automatically linkifies things like URLs and phone numbers. -->
  <TextView
            android:id="@+id/text1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:autoLink="all"
            android:text="@string/link_text_auto"
            />
34

How get Android SDK location on PC with Eclipse | how-get-android-sdk-location-on-pc-with-eclipse


How get Android SDK location - PATH on PC from Eclipse tutorial.


  1. Open dialog from menu Window -> AVD and SDK manager

  2. In dialog select Available packages

  3. On top of dialog will displayed similar path: SKD Location: C:\PROGRA~1\Android\android-sdk-windows\



138

Draw text drawText Android basic example | draw-text-drawtext-android-basic-example


drawText(), setColor(), setTextSize(), setTextAlign()

public class ApokusActivity extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(new SampleView(this));
	}

	private static class SampleView extends View {

		// CONSTRUCTOR
		public SampleView(Context context) {
			super(context);
			setFocusable(true);

		}
		@Override
		protected void onDraw(Canvas canvas) {
			Paint paint = new Paint();
			
            paint.setColor(Color.YELLOW);
            paint.setTextSize(60);
            //paint.setTextAlign(Paint.Align.CENTER);

            canvas.drawText("Hello world!", 0, 50, paint);
		}

	}
}



Editace: 2014-02-15 20:15:37
Počet článků v kategorii: 397
Url:addpreferencesfromresource-deprecated-android-code-warning

AD
11 Share
Share
Tweet