Android Studio hide delete import module
Hide module - open dialog: File > Project Structure Ctrl + Alt + Shift + S
Hide module: in opened Dialog select module which will hidden and click on minus (left upper corner)
If module is hidden, you can permanetly delete module from disk. But if you want using module in future, copy module into other folder (not into AndroidProjects folder and his subbfolders) and delete module permanetly from project and disc. Right mouse click on module and select from menu Delete.
If you want import the backup copy to project, use: File>New>Import mudule
Hide module: in opened Dialog select module which will hidden and click on minus (left upper corner)
If module is hidden, you can permanetly delete module from disk. But if you want using module in future, copy module into other folder (not into AndroidProjects folder and his subbfolders) and delete module permanetly from project and disc. Right mouse click on module and select from menu Delete.
If you want import the backup copy to project, use: File>New>Import mudule
396LW NO topic_id
AD
Další témata ....(Topics)
Warning in AndroidManifest.xml:
tag should specify a target API level (the highest verified version; when running on
later versions, compatibility behaviors may be enabled) with android:targetSdkVersion="?"
Solution:
later versions, compatibility behaviors may be enabled) with android:targetSdkVersion="?"
Solution:
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="16" />
- create new folder with values in resources folder in project with extension your language code
For example:
My language is Czech (cs)
I have to create the folder values-cs in res folder
Into every values folder put strings.xml file
Translate every string from values folder into your locale.
If user selected your locale in device settings, application selects a string from the correct (proper) folder.
For example:
My language is Czech (cs)
I have to create the folder values-cs in res folder
// for locale English is default
/MyProject/res/values
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">App English default</string>
<string name="action_settings">Settings English default</string>
<string name="hello_world">Hello world</string>
</resources>
// for locale Czech (cs)
/MyProject/res/values-cs
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Aplikace česky cs</string>
<string name="action_settings">Nastavení česky</string>
<string name="hello_world">Ahoj světe!</string>
</resources>
// for locale English US (r is region)
/MyProject/res/values-en-rUS
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">App English Us locale</string>
<string name="action_settings">Settings English Us locale</string>
<string name="hello_world">Hello world from USA :)</string>
</resources>
Into every values folder put strings.xml file
Translate every string from values folder into your locale.
If user selected your locale in device settings, application selects a string from the correct (proper) folder.
Wiktionary - SDK samples Android
about.xml
protected void showAbout() {
// Inflate the about message contents
View messageView = getLayoutInflater().inflate(R.layout.about, null, false);
// When linking text, force to always use default color. This works
// around a pressed color state bug.
TextView textView = (TextView) messageView.findViewById(R.id.about_credits);
int defaultColor = textView.getTextColors().getDefaultColor();
textView.setTextColor(defaultColor);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setIcon(R.drawable.app_icon);
builder.setTitle(R.string.app_name);
builder.setView(messageView);
builder.create();
builder.show();
}
about.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source Project
//www.apache.org/licenses/LICENSE-2.0
-->
<LinearLayout xmlns:android="//schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dip">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="@string/app_descrip"
android:textColor="?android:attr/textColorPrimaryInverse" />
<TextView
android:id="@+id/about_credits"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dip"
android:textSize="16sp"
android:text="@string/app_credits"
android:autoLink="web"
android:textColor="?android:attr/textColorPrimaryInverse" />
</LinearLayout>
StringBuilder, res/raw folder, try catch finaly throws, BufferedReader, InputStream, openRawResource, getResources Android example
MainActivity.java
MainActivity.java
public class MainActivity extends Activity {
TextView txtV;
Context cntx;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txtV = (TextView)findViewById(R.id.idLabel);
cntx = this;
try {
StringBuilder strBuilder = myFunction(cntx);
txtV.setText(strBuilder);
} catch (IOException e) {
e.printStackTrace();
}
}
private StringBuilder myFunction(Context context) throws IOException {
final Resources resources = context.getResources();
InputStream inputStream = resources.openRawResource(R.raw.my_file);
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder strBuild = new StringBuilder();
try {
String line;
while ((line = reader.readLine()) != null) {
strBuild.append(line);
}
} finally {
reader.close();
}
return strBuild;
}
}
Switch statement with numbers and array of strings Java example.
Possible:
public class MainClass {
public static void main(String[] arg) {
String[] arrayOfString = { "One", "Two", "Three", "Four" };
int i = 2;
switch (i) {
case 1: {
System.out.println(arrayOfString[i]);
break;
}
case 2: {
System.out.println(arrayOfString[i]);
break;
}
case 3: {
System.out.println(arrayOfString[i]);
break;
}
default: {
System.out.println("Enter a valid value.");
}
} // END of switch
}
}
/*
* Three
*/
Possible:
case 1:
System.out.println(arrayOfString[i]);
break;
// i love this notation
case 1:{
System.out.println(arrayOfString[i]);
}break;
case 1:{
System.out.println(arrayOfString[i]);
break;
}
Editace: 2015-11-24 11:17:23
Počet článků v kategorii: 396
Url:android-studio-hide-delete-import-module