SD card SDcard get external storage directory Android
Environment.getExternalStorageDirectory()+ File.separator
AndroidManifest.xml
Boolean canWrite = Environment.getExternalStorageDirectory().canWrite() ;
if(canWrite){
File f = new File(Environment.getExternalStorageDirectory()
+ File.separator + "my_image.jpg")
f.createNewFile();
}else{
}
AndroidManifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
396LW NO topic_id
AD
Další témata ....(Topics)
// on bottom of onCreate add listener
mInterstitialAd .setAdListener(new AdListener(){
public void onAdLoaded(){
interstitial.show();
}
});
} // end onCreate
public void displayInterstitial (){
if (mInterstitialAd.isLoaded()) {
mInterstitialAd.show();
}
}
do while Java example
public class MainClass {
public static void main(String[] arg) {
String[] arrayOfString = { "Hello", "people", "hello", "world!" };
int i = 0;
// first cycle is always executed
do {
System.out.println("Loop: " + i);
System.out.println(arrayOfString[i]);
i++;
}while ( i == -1 );
}
}
/*
Loop: 0
Hello
*/
public class MainClass {
public static void main(String[] arg) {
String[] arrayOfString = { "Hello", "people", "hello", "world!" };
int i = 0;
do {
System.out.println("Loop: " + i);
System.out.println(arrayOfString[i]);
i++;
}while ( i < arrayOfString.length );
}
}
/*
Loop: 0
Hello
Loop: 1
people
Loop: 2
hello
Loop: 3
world!
*/
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!
*/
Example source code for Android development. How set gray text to EditText when EditText is blank.
Hint text to display when the text is empty.
In layout/main.xml insert to EditText row Attribute Name android:hint="Some text"
Programatically you can use method setHint:
Hint text to display when the text is empty.
In layout/main.xml insert to EditText row Attribute Name android:hint="Some text"
<EditText
android:id="@+id/myEdit"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:hint="Some text"
android:singleLine="true"
</EditText>
Programatically you can use method setHint:
// setHint(CharSequence hint) example
(EditText)findViewById(R.id.myEdit).setHint("My text");
// or int resId as method setHint(int resId)
EditText myEdit = findViewById(R.id.myEdit);
myEdit.setHint(R.string.app_name);
How set JAVA path to Environment Variables on Windows (7)
Select Start menu > Computer > System Properties > Advanced System Settings(properties).
Then open Advanced tab > Environment Variables and add a new system variable JAVA_HOME that points to your JDK folder, for example
Select Start menu > Computer > System Properties > Advanced System Settings(properties).
Then open Advanced tab > Environment Variables and add a new system variable JAVA_HOME that points to your JDK folder, for example
C:\Program Files\Java\jdk1.8.0_05
Editace: 2013-12-09 10:08:22
Počet článků v kategorii: 396
Url:sd-card-get-external-storage-directory-android