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.

Resource int R.string.app_name to String Android example


AD MOB

R.string.app_name to String example.
MyActivity.java

Resources res = getResources();
String sText = res.getString(R.string.app_name);


res/values/string.xml


<resources>
    <string name="app_name">My app name</string>
</resources>


397LW NO topic_id




AD

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


203

Motorola Droid Razr - Smartphone | motorola-droid-razr-smartphone






























Brand Motorola
Model (codename) Droid Razr
Price (cena, včetně DPH v KCZ) 10800 / 06.2012
Display size in Inch (v palcích) 4.3
Display-resolution 540x960
Dotek-typ capacitive
CPU typ TI 4430
CPU MHz 1.2 GB
CPU core 2
L2 cache
RAM 1024
ROM 15600
GPU SGX540
NenaMark2 Benchmark
GPU-GLBenchmark 3299
Baterie mAh 1780
Foto MPx 8
Autofocus AF
Video HD video 30 frames/s
Official Android ICS Google Android 2.3.5 (Gingerbread)
CyanogenMod support
Dotek-prstů-max 10
Display-ppi 256
Display-retina 79%
Networks
Connectivity GSM: 850/900/1800/1900 MHz, EDGE, GPRS 3G: 900/2100 MHz, HSDPA, HSUPA, HSPA+ Bluetooth: 4.0 (EDR, A2DP, FTP, PBAP, AVRCP) Wi-Fi: 802.11b/g/n PC: microUSB, USB 2.0, microHDMI Senzors: proximity, gyroskop, akcelerometr GPS: yes, A-GPS, digital compas
Note Super AMOLED Display


Motorola Droid Razr image
motorola-droid-razr

361

Save Instance State if device is rotated | save-instance-state-if-device-is-rotated


Try this trick.
In AndroidManifest - activity tag write this code
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
App hold data of a views if will to rotation of device.


       <activity
 android:name=".Tests_Activity"
 android:label="@string/app_name"
 android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
9

Button Android | button-android


Google Android button example source code for developers.

// get handle
Button myButton;
myButton = (Button)findViewById(R.id.idMyButton);
//set focus
myButton.requestFocus();
// set background image
myButton.setBackgroundResource(R.drawable.backImage);
// or
myButton.setBackgroundDrawable(getResources().getDrawable( R.drawable.someImage));

// set visibility
myButton.setVisibility(View.INVISIBLE); // VISIBLE

///////// SET LISTENER
       Button myButton =(Button)findViewById(R.id.button1);
        myButton.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                Toast.makeText(getApplicationContext(), "AHOJ",
                    Toast.LENGTH_LONG).show();
            }
        });	

// or set onClickListener
 myButton.setOnClickListener(myListener);
//end onCreate .....
   private OnClickListener myListener = new OnClickListener() {
        public void onClick(View v) {

        }
   }



252

How get bitmap dimension without loading Android example | how-get-bitmap-dimension-without-loading-android-example


Bitmap Width, Height without memory allocation:

BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(getResources(), R.id.myimage, options);
// now opts.outWidth and opts.outHeight are the dimension of the
// bitmap, even though Bitmap is null
int imageHeight = options.outHeight;
int imageWidth = options.outWidth;
String imageType = options.outMimeType;
171

WebView change height Android Example | webview-change-height-android-example


The Android WebView changing the height according to text size.
If you need to change the height to a minimum try this source:

//public void loadDataWithBaseURL (String baseUrl, String data, String mimeType, String encoding, String historyUrl) 
WebView _webView; // findById(.....
String entryContent = "";
 _webView.loadDataWithBaseURL(
	"blabol",//  javascript i styly
	entryContent, null,
	"utf-8", null
);



Editace: 2011-11-07 08:59:41
Počet článků v kategorii: 397
Url:resource-int-r-string-app_name-to-string-android-example

AD
11 Share
Share
Tweet