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: Show current date

 

 

Solution 1:

//-< Current Time >-

SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
String now = sdf.format(
new Date());
//-</ Current Time >-

 

 

 

 

 

Java code:

public void create_Table(){
       
//-------< create_Table() >--------
       
TableLayout tbl=findViewById(R.id.table_main);

        
//--< Row >--
       
TableRow row=new TableRow(this);
        row.setPadding(
2,2,2,2);

       
//< cell1 >
//        Time now = Time.;
//        now.getTime();
        //-< Current Time >-
       
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
        String now = sdf.format(
new Date());
       
//-</ Current Time >-

       
TextView lbl1=new TextView(this);
        lbl1.setText(now);
        lbl1.setTextColor(Color.
RED);
        lbl1.setBackgroundColor(Color.
YELLOW);
        row.addView(lbl1);
       
//</ cell1 >

        //< cell2 >
       
TextView lbl2=new TextView(this);
        Drawable back1= getDrawable(R.drawable.
table_layout);
        lbl1.setBackground(back1);

        row.addView(lbl2);
       
//</ cell1 >
        //--</ Row >--

        //< add to table >
       
tbl.addView(row);
       
//</ add to table >
        //-------</ create_Table() >--------
   
}

 

 

Mobile
»
Android Java: Read text from a resource file
»
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

.

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