How rebuild only one module in project Android Studio
If you do click on Rebuid project menu item, this operation maybe consume long time on slovly PC.
Some errors dismis when you do rebuild project, or module.
Try this:
Select module where contains red error code and press Debugg or Run button on Android Studio.
If module code contains errors, Android Studio show error report in gradle console.
If not, apk will installed on device.
This is 10 times faster than Clean - Rebuild all project.
Some errors dismis when you do rebuild project, or module.
Try this:
Select module where contains red error code and press Debugg or Run button on Android Studio.
If module code contains errors, Android Studio show error report in gradle console.
If not, apk will installed on device.
This is 10 times faster than Clean - Rebuild all project.
396LW NO topic_id
AD
Další témata ....(Topics)
Zipalign.exe path on Windows:
c:\Program Files\Android\android-sdk-windows\tools\zipalign.exe
How do signs .apk with your private key - image:
More about Zipalign android.com
c:\Program Files\Android\android-sdk-windows\tools\zipalign.exe
zipalign [-f] [-v] <alignment> infile.apk outfile.apk
// command line in Total Commander
zipalign.exe -f -v 4 infile.apk outfile.apk
When using Eclipse with the ADT plugin, the Export Wizard will automatically zipalign your .apk after it signs it with your private key.
How do signs .apk with your private key - image:
More about Zipalign android.com
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
import android.content.Context;
import android.media.AudioManager;
import android.media.SoundPool;
public class SoundManager
{
private SoundPool soundPool;
private int[] sm;
Context context;
public SoundManager(Context context) {
this.context = context;
soundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0);
sm = new int[2];
// fill your sounds
sm[0] = soundPool.load(context, R.raw.my_sound1, 1);
sm[1] = soundPool.load(context, R.raw.my_sound2, 1);
}
public final void playSound(int sound) {
AudioManager mgr = (AudioManager)context.getSystemService(
Context.AUDIO_SERVICE);
float streamVolumeCurrent =
mgr.getStreamVolume(AudioManager.STREAM_MUSIC);
float streamVolumeMax = mgr.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
float volume = streamVolumeCurrent / streamVolumeMax;
soundPool.play(sm[sound], volume, volume, 1, 0, 1f);
}
public final void cleanUpIfEnd() {
sm = null;
context = null;
soundPool.release();
soundPool = null;
}
}
Get assets folder files to array of strings.
Its show files in assets folder and sub folders:
Its show files in assets folder and sub folders:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final AssetManager assetManager = getAssets();
try {
// for assets folder add empty string
String[] filelist = assetManager.list("");
// for assets/subFolderInAssets add only subfolder name
String[] filelistInSubfolder = assetManager.list("subFolderInAssets");
if (filelist == null) {
// dir does not exist or is not a directory
} else {
for (int i=0; i<filelist.length; i++) {
// Get filename of file or directory
String filename = filelist[i];
}
}
// if(filelistInSubfolder == null) ............
} catch (IOException e) {
e.printStackTrace();
}
}
// image from res/drawable
int resID = getResources().getIdentifier("my_image",
"drawable", getPackageName());
// view
int resID = getResources().getIdentifier("my_resource",
"id", getPackageName());
// string
int resID = getResources().getIdentifier("my_string",
"string", getPackageName());
Editace: 2016-03-13 10:06:11
Počet článků v kategorii: 396
Url:how-rebuild-only-one-module-in-project-android-studio