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.

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.

397LW NO topic_id



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


243

Dialog With RadioButton Android Example | dialog-with-radiobutton-android-example



private void dialogModeFC() {
	try {
	final AlertDialog alertDialog =	new AlertDialog.Builder(MainActivity.this)
    .setTitle(R.string.select_dialog)
    //.setItems(
    .setSingleChoiceItems(R.array.select_dialog_items, -1
    		, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {

        /* User clicked so do some stuff 
        <item>Happy New Year</item>
        <item>Merry Christmas</item>
        <item>I Love You</item>
        */
            String[] items = getResources().getStringArray(R.array.select_dialog_items);
// list with boolean variables - which is true
//            for (int i = 0; i < _listMode.size(); i++) {
//            	_listMode.set(i, false);
//            }
//            _listMode.set(which, true);
            dialog.dismiss();
//            new AlertDialog.Builder(MainActivity.this)
//                    .setMessage("You selected: " + which + " , " + items[which])
//                    .show();
        }
    })
    .create();
	alertDialog.show();
	} catch (Exception e) {
		e.printStackTrace();
		Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG)
				.show();//("dialogModeFC", e.getMessage().toString());
	}
}// end dialogModeFC	
6

Show keyboard | show-keyboard


Show keyboard Android phone apps development example source code.

// ActivityClass.java
InputMethodManager showSoftInput;
Button hBtnKeyboardShow ;
//onCreate
showSoftInput = (InputMethodManager)this.getSystemService(Context.INPUT_METHOD_SERVICE);

hBtnKeyboardShow = (Button)findViewById(R.id.btnKeyboardShow);
hBtnKeyboardShow.setOnClickListener(myButtonListener);
// END onCreate

//button listener
private OnClickListener myButtonListener = new OnClickListener() {
     public void onClick(View v) {
     	 try {
     		 showSoftInput.getInputMethodList();
                 showSoftInput.toggleSoftInput(showSoftInput.SHOW_FORCED, 0);	
		} catch (Exception e) {
			Log.e("Keyboard show ", e.getMessage());
			
		}
     }
};


218

Java pass variable as reference | java-pass-variable-as-reference


Integer, Float, String, List passed as reference in JAVA example source code:

// List passed as reference JAVA
List<Integer>list = new ArrayList<Integer>();

public void fc (List<Integer>listRef){
listRef.add(7);
listRef.add(5);
}
fc(list); // 7, 5 


// String passed as reference JAVA
	public void mutate(AtomicReference<Object> ref) { ref.set("Goodbye"); }

		AtomicReference<Object> ref = new AtomicReference<Object>("Hello");
		mutate(ref);
		System.out.println(ref.get()); //Goodbye!
             String s = (String) ref.get();


// Integer passed as reference JAVA
	private static void mutate(AtomicReference<Object> ref) { ref.set(7); }

	//public static void main(String[] arg) {
		AtomicReference<Object> ref = new AtomicReference<Object>(5);
		mutate(ref);
		System.out.println(ref.get()); // 7
int n = (Integer) ref.get();


// Float passed as reference JAVA
	private static void mutate(AtomicReference<Object> ref) { ref.set(14.8f); }

	//public static void main(String[] arg) {
		AtomicReference<Object> ref = new AtomicReference<Object>(12.1f);
		mutate(ref);
		float f = (Float) ref.get();
		System.out.println(f); //14.8

227

Eclipse custom skin GUI color theme | eclipse-custom-skin-gui-color


Eclipse make own color of toolbars, windows, status bar etc.
https://github.com/jeeeyul/eclipse-themes/wiki/Alternative-Install

eclipse-custom-skin-gui-2.jpg

eclipse-custom-skin-gui.png
369

View getId is null Android | view-getid-is-null-android


If you create a button or view programmatically with OnClickListener you can set a tag key before button in parent layout is added.
And get correct button by this tag getTag() instead getId() in OnClickListener etc.

Button button = new Button(getApplicationContext());
int idOfButton = button.getId(); // return -1

button.setTag("my_button");
String sTag = (String) button.getTag(); // return "my_button"



Editace Jana Žákovská : 2016-03-13 10:06:11
Počet článků v kategorii: 397
Url:how-rebuild-only-one-module-in-project-android-studio
Share
Share
Tweet