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.

Android Studio lock unlock file make read only or writable



Select file in project explorer
Menu:
File - Make File Read-only - to lock
File - Make File Writable - to unlock

android-studio-lock-unlock-file.png

397LW NO topic_id



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


15

int java android example | int-java-android-example


int occupy 4 bytes (32 bits) in memory

int in Java example of using Integer and Array of Integer and Iteger to String

        // get max end min values of int in Java example 4 bytes (32 bits) PC architecture
	System.out.println(Integer.MAX_VALUE); // 2147483647
	System.out.println(Integer.MIN_VALUE); // -2147483648


// members variable
private int mProgress = 10;

//integer to string java
int myInteger = 8;
String myString = Integer.toString(myInteger);

// a final variable can only be initialized once
static final int NUM_PARTICLES = 15;

 for (int i = 0; i < NUM_PARTICLES ; i++) { 
// do something
}

// int as return value of function
public int getCount() {
return 5;
}

// int as a parametr of function
public float getFloatFromInt(int i) {
float fRet = (float) i;
 return fRet;
}

//array of int
int[] anArray;              // declares an array of integers
          anArray = new int[2];      // allocates memory for 2 integers
          anArray[0] = 100; // initialize first element
          anArray[1] = 200; // initialize second element

for (int i = 0; i < anArray.length; i++) {
// print out values from anArray
System.out.println("Index: " + i);
System.out.println("Value: " + anArray[i]); 
}


172

Android Samples | android-samples











AbsListView
AbstractAccountAuthenticator
AbstractThreadedSyncAdapter
AccelerateInterpolator
AccessibilityEvent
AccessibilityService
AccessibilityServiceInfo
Account
AccountAuthenticatorActivity
AccountAuthenticatorResponse
AccountManager
Activity
ActivityInfo
ActivityInstrumentationTestCase2
ActivityManager
ActivityUnitTestCase
AdapterContextMenuInfo
AdapterView
AlarmManager
AlertDialog
AlphaAnimation
AndroidTestCase
Animation
AnimationSet
AnimationUtils
Application
ApplicationTestCase
AppWidgetManager
AppWidgetProvider
ArrayAdapter
AssetFileDescriptor
AsyncTask
AttributeSet
AudioManager
AuthenticatorDescription
AuthenticatorException
AutoCompleteTextView
BackupAgent
BackupAgentHelper
BackupDataInput
BackupDataOutput
BackupManager
BaseAdapter
BaseColumns
BaseExpandableListAdapter
Binder
Bitmap
BitmapDrawable
BitmapFactory
BitmapShader
BluetoothAdapter
BluetoothDevice
BluetoothServerSocket
BluetoothSocket
BroadcastReceiver
Build
Bundle
Button
Callback
Camera
CameraInfo
Canvas
Color
ColorFilter
CompletionInfo
ComponentName
CompoundButton
ConditionVariable
Config
ConfigurationInfo
Contacts
ContactsContract
ContentProvider
ContentProviderClient
ContentProviderOperation
ContentResolver
ContentUris
ContentValues
Context
ContextMenu
ContextMenuInfo
Cursor
CursorAdapter
Data
DatePicker
DatePickerDialog
DecelerateInterpolator
DeviceAdminReceiver
DevicePolicyManager
Dialog
DialogInterface
Display
DisplayMetrics
Drawable
Editable
EditorInfo
EditText
EditTextPreference
Email
Environment
Equalizer
ETC1Util
ExpandableListActivity
ExpandableListAdapter
ExpandableListContextMenuInfo
ExpandableListView
FileBackupHelper
FillType
Filterable
FloatMath
FocusFinder
FormatException
Gallery
Gesture
GestureDetector
GestureLibraries
GestureLibrary
GestureOverlayView
GLES10
GLES20
GLSurfaceView
GLU
GLUtils
Gravity
GridView
Handler
HandlerThread
Html
CharArrayBuffer
CheckBox
CheckBoxPreference
Chronometer
IBinder
Im
ImageButton
ImageSwitcher
ImageView
InputConnection
InputMethodManager
InputMethodService
Instrumentation
Intent
IntentFilter
JetPlayer
Key
Keyboard
KeyboardView
KeyEvent
KeyCharacterMap
LayoutAnimationController
LayoutInflater
LayoutParams
LinearLayout
LinkMovementMethod
ListActivity

ListAdapter
ListPreference
ListView
LiveFolders
Log
Looper
Matrix
MediaController
MediaPlayer
MediaScannerConnection
MediumTest
Menu
MenuInflater
MenuItem
Message
Messenger
MetaKeyKeyListener
MoreAsserts
MotionEvent
MovementMethod
MultiAutoCompleteTextView
NameNotFoundException
NdefMessage
NdefRecord
NfcAdapter
Notification
NotificationManager
OnAccountsUpdateListener
OnBufferingUpdateListener
OnClickListener
OnCompletionListener
OnCheckedChangeListener
OnInitListener
OnItemClickListener
OnItemSelectedListener
OnJetEventListener
OnKeyListener
OnPreparedListener
OnScrollListener
OnSharedPreferenceChangeListener
OnTouchListener
OnVideoSizeChangedListener
OperationApplicationException
OperationCanceledException
Options
PackageInfo
PackageManager
Paint
PaintDrawable
PaintFlagsDrawFilter
Parcel
Parcelable
ParcelFileDescriptor
Path
PendingIntent
People
Phone
Phones
Picture
PictureDrawable
PixelFormat
PorterDuff
PorterDuffXfermode
PowerManager
Preference
PreferenceActivity
PreferenceCategory
PreferenceManager
PreferenceScreen
Process
ProgressBar
ProgressDialog
QuickContactBadge
RadioButton
RadioGroup
RatingBar
RawContacts
RecognitionService
RecognizerIntent
Rect
RectF
RelativeLayout
RemoteCallbackList
RemoteException
RemoteViews
ResolveInfo
ResourceCursorAdapter
Resources
Row
ScaleGestureDetector
ScrollingMovementMethod
ScrollView
SearchManager
SearchRecentSuggestions
SearchRecentSuggestionsProvider
SeekBar
Sensor
SensorEvent
SensorEventListener
SensorManager
Service
ServiceConnection
ServiceTestCase
Shader
ShapeDrawable
SharedPreferences
SimpleAdapter
SimpleCursorAdapter
SimpleCursorTreeAdapter
SimpleExpandableListAdapter
Size
SmallTest
SmsManager
SmsMessage
SpannableString
Spanned
SparseArray
SpeechRecognizer
Spinner
SpinnerAdapter
SQLException
SQLiteDatabase
SQLiteOpenHelper
SQLiteQueryBuilder
StatusUpdates
StructuredName
Style
StyleSpan
Surface
SurfaceHolder
SurfaceView
SyncResult
SystemClock
TabActivity
TabHost
TableLayout
TableRow
TabSpec
TestSuiteBuilder
TextSwitcher
TextToSpeech
TextUtils
TextView
TextWatcher
Time
TimePicker
TimePickerDialog
Toast
ToggleButton
Transformation
TranslateAnimation
TypedArray
Typeface
UiThreadTest
Uri
UriMatcher
URLSpan
Vibrator
VideoView
View
ViewFlipper
ViewGroup
ViewParent
ViewSwitcher
Visualizer
WakeLock
WallpaperManager
WallpaperService
WebView
Window
WindowManager
Xfermode
Xml
XmlResourceParser

159

Array copy to Array Java Android example | array-copy-to-array-java-android-example



    String[] source = {"Hello","world","by","Android"};
    
    String[] destination = new String[source.length];
   
    System.arraycopy(source, 0, destination, 0, source.length);

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) {

        }
   }



8

Display screen size resolution density dimension Android | display-screen-dimension


Get display, screen resolution - dimension Android phone development example source code.

 Display display = getWindowManager().getDefaultDisplay();
int nWidth = display.getWidth();
int nHeight = display.getHeight();

          DisplayMetrics metrics = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getMetrics(metrics);
            //get density per inch for example: 120 , 160 , 240
            mXDpi = metrics.xdpi; // 160 The exact physical pixels per inch of the screen in the X dimension. 
            mYDpi = metrics.ydpi;

// density
int nDensity = metrics.densityDpi; // 160 screen density expressed as dots-per-inch

          float  mMetersToPixelsX = mXDpi / 0.0254f; // 1 inch == 0.0254 metre
          float  mMetersToPixelsY = mYDpi / 0.0254f;
          
// Resolution
// The total number of physical pixels on a screen.
int wPix = metrics.widthPixels; // 320 The absolute width of the display in pixels.
int hPix = metrics.heightPixels; // 480 The absolute height of the display in pixels.
int nWidthDisplay = (wPix < hPix)? wPix : hPix;

float nWidthScreenInInch = wPix / mXDpi; //320 / 160 == 2.0 in inch.
float nHeightScreenInInch = hPix / mYDpi; //480 / 160 == 3.0 in inch.

// for example:
// density 120 per inch
//width 320 pix / 120 dpi == width 2.66 inch
//height 480 pix / 120 dpi == height 4.0 inch 

// density 240 per inch
//width 320 pix / 240 dpi == width 1.33 inch
//height 480 pix / 240 dpi == height 2.0 inch 




Example:
HTC Desire HD
11 (4.3) Diagonal cm (in)
480×800 Resolution
85 (217) ppcm (PPI - Pixels per inch)

480 / 217 = 2.21 inch
800 / 217 = 3.69 inch
Math.sqrt( 2.21*2.21 + 3.69 * 3.69) = 4.3 inch - diagonal

//en.wikipedia.org/wiki/Pixels_per_inch
//en.wikipedia.org/wiki/Dots_per_inch

Typical screen widths:

320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).


Emulator skins in the Android SDK
//developer.android.com/guide/practices/screens_support.html









































Low density (120), ldpi

Medium density (160), mdpi

High density (240), hdpi

Extra high density (320), xhdpi

Small screen
QVGA (240x320) 480x640

Normal screen
WQVGA400 (240x400)

WQVGA432 (240x432)
HVGA (320x480) WVGA800 (480x800)

WVGA854 (480x854)

600x1024
640x960

Large screen
WVGA800** (480x800)

WVGA854** (480x854)
WVGA800* (480x800)

WVGA854* (480x854)

600x1024

Extra Large screen
1024x600 WXGA (1280x800)

1024x768
1280x768
1536x1152
1920x1152

1920x1200
2048x1536
2560x1536

2560x1600
* To emulate this configuration, specify a
custom density of 160 when creating an AVD that uses a WVGA800 or WVGA854 skin.

** To emulate this configuration, specify a custom density of 120 when creating an AVD that
uses a WVGA800 or WVGA854 skin.

† This skin is available with the Android 3.0 platform


Editace Jana Žákovská : 2015-12-04 19:50:55
Počet článků v kategorii: 397
Url:android-studio-lock-unlock-file-make-read-only-or-writable
Share
Share
Tweet