Freelance Project Requests info@CodeDocu.de Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net
#

Android java: Code area // region - // endregion

 

How to create a code area in Android?

 

Solution:

With // region code // endregion

 

Closed // region area

Region:Color_Picker

 

 

 

Opened // region - // end region area

//region Region:Color_Picker
    //===================< region: Color_Picker >===================
   
public void load_Color_Picker() {
       
//------------< load_Color_Picker() >-----------
        //< init >
        //*Colors from file colors_picker.xml
       
String[] colors = getResources().getStringArray(R.array.color_picker);
       
//</ init >

        //----< @Loop: Colors-Array >----
       
Integer iMax=colors.length;
       
for( Integer iColor=0;iColor< colors.length;iColor++) {
           
//-< create Color_Button >-
           
String color = colors[iColor];
            Button btn =
new Button(this);
            btn.setBackgroundColor(Color.parseColor(color));
            btn.setOnClickListener(
onColor_clicked);
           
//-< create Color_Button >-

            //< add >
           
LinearLayout panel_color = findViewById(R.id.panel_ColorPicker);
            panel_color.addView(btn);
            LinearLayout.LayoutParams lp=
new LinearLayout.LayoutParams(60,LinearLayout.LayoutParams.WRAP_CONTENT);
            btn.setLayoutParams(lp);
           
//</ add >
       
}
       
//----</ @Loop: Colors-Array >----
        //------------</ load_Color_Picker() >-----------
   
}

    View.OnClickListener
onColor_clicked = new View.OnClickListener() {
       
public void onClick(View view) {
           
//-----------< onButton_clicked() >------------
            //< get_button >
           
Button btn=(Button) view;
            ColorDrawable viewColor = (ColorDrawable) btn.getBackground();
           
int colorId = viewColor.getColor();
            String sColor=String.valueOf(colorId);
           
//</ get_button >

            //--< set_Note_Color >--
           
EditText edit=_row_Input.findViewWithTag("edit_" + _sDateShort_Input);
           
if(edit!=null)
            {
                edit.setBackgroundColor(colorId);
            }
           
//--</ set_Note_Color >--

            //-----------</ onButton_clicked() >------------
        
}
    };
   
//===================</ region: Color_Picker >===================
//endregion

 

 

 

In C #

#region #endregion

Mobile
»
Android Java: Create unique GUID at runtime
»
Android Java: Comparison with empty string
»
Android java: Code area // region - // endregion
»
Android: Create a color picker
»
Android: View items by name or tag or id
»
Android Java: Create a view event at runtime and assign it to a view element
»
Android Java: Create view button at runtime
»
Android Java: create a view element as a float
»
Input field in Android
»
Android Java: compare date day

.

Contact for Jobs, Project Requests: raimund.popp@microsoft-programmierer.de