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.

Append text and ad text to TextView Android example


AD MOB


String s = "Some text for appending

"; TextView mTitle = (TextView) findViewById(R.id.title_text); mTitle.setText(R.string.app_name); // insert text from strings.xml mTitle.append(s); // append string like a variable value mTitle.append("My string will appended
"); // append string

You can insert this source code into onCreate in your activity file

397LW NO topic_id




AD

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


142

Create bitmap and draw text into bitmap Android example | create-bitmap-and-draw-text-into-bitmap-android-example



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();
			
			canvas.drawColor(Color.GREEN);
            
           Bitmap b = Bitmap.createBitmap(200, 200, Bitmap.Config.ALPHA_8);
           Canvas c = new Canvas(b);
           c.drawRect(0, 0, 200, 200, paint);
           
           paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
           paint.setTextSize(40);
           paint.setTextScaleX(1.f);
           paint.setAlpha(0);
           paint.setAntiAlias(true);
           c.drawText("Your text", 30, 40, paint);
           paint.setColor(Color.RED);
           
           canvas.drawBitmap(b, 10,10, paint);
		}

	}
}


draw-text-into-bitmap-android

292

toLowerCase Locale toUperCase Locale Java Android | tolowercase-locale-toupercase-locale-java-android



String s = "AbcČ";
String s2 = s.toLowerCase(new Locale("cs_CZ")); // Czech Republic
String s3 = s.toLowerCase(new Locale("de_DE")); // Germany

//
en_US
en_GB
ar_EG
be_BY
bg_BG
ca_ES
cs_CZ
da_DK
de_DE
216

Java pass variable as reference | java-pass-variable-as-reference


Integer, Float, String, List passed as reference in JAVA example source code:

// List passed as reference JAVA
List<Integer>list = new ArrayList<Integer>();

public void fc (List<Integer>listRef){
listRef.add(7);
listRef.add(5);
}
fc(list); // 7, 5 


// String passed as reference JAVA
	public void mutate(AtomicReference<Object> ref) { ref.set("Goodbye"); }

		AtomicReference<Object> ref = new AtomicReference<Object>("Hello");
		mutate(ref);
		System.out.println(ref.get()); //Goodbye!
             String s = (String) ref.get();


// Integer passed as reference JAVA
	private static void mutate(AtomicReference<Object> ref) { ref.set(7); }

	//public static void main(String[] arg) {
		AtomicReference<Object> ref = new AtomicReference<Object>(5);
		mutate(ref);
		System.out.println(ref.get()); // 7
int n = (Integer) ref.get();


// Float passed as reference JAVA
	private static void mutate(AtomicReference<Object> ref) { ref.set(14.8f); }

	//public static void main(String[] arg) {
		AtomicReference<Object> ref = new AtomicReference<Object>(12.1f);
		mutate(ref);
		float f = (Float) ref.get();
		System.out.println(f); //14.8

181

Motorola Droid X | motorola-droid-x


Motorola Droid X cena od 3 000 KCZ Kč (únor.2012)
Spokojenost uživatelů nadprůměrná.
Motorola Droid X je chytrý telefon s operačním systémem Android.
Motorola Droid X je (22.února2012) 8. nejpoužívanějším chytrým telefonem u programu Sky Map viz tabulka.

Android 2.1
Display 854 x 480 pixelů
8 megapixel fotoaparát dual LED flash
720p HD video recording
Music and Video player
8 GB paměť
rozšíření paměti 32 GB
WiFi/DLNA
TI OMAP3630 processor – 1GHz
4.3-inch large display

Motorola Droid X photo pic image
Motorola Droid X
Zdroj obrázku: wikipedia
74

Continue statement Java example | continue-statement-java-example


For and continue statement in Java.

public class MainClass {
	public static void main(String[] arg) {
		String[] arrayOfString = { "Hello", "people", "hello", "world!" };

		for (int i = 0; i < arrayOfString.length; i++){
			if(arrayOfString[i].equals("hello"))
				continue; // skip to for
			System.out.println(arrayOfString[i]);
		}
	}
}
/*
Hello
people
world!
*/


Editace: 2011-11-25 13:01:42
Počet článků v kategorii: 397
Url:append-text-and-ad-text-to-textview-android-example

AD
11 Share
Share
Tweet