Posts

Showing posts from October, 2020

Android Popup box/Dialog box code example - Java

Image
When Developing an Android application, sometimes you want to have confirmation on the action done by the user. Using a popup box or dialog box will help to get the user's intention on what are they doing.  Here is the sample code to use the popup box/dialog box to show a message to the user.  Full Code example. import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import android.content.DialogInterface; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public void onBackPressed(){ ShowMessageExit("Are You Sure You Want To Quit?"); } private void ShowMessageExit(String Message){ new AlertDialog.Builder(this) .setMessage(Message) .setPositiveButton(android.R.str...

How to create DataGrid or GridView in JSP - Servlet

Image
Hi there, today I will like to share my knowledge on creating basic Datagrid in JSP. This is my solution but not a permanent solution in all other cases. Maybe you can enhance this code to achieve your own objective. In this tutorial, I will use basic servlet and JSP. Note: In this tutorial, I will use this library:- MySQL JDBC Driver JSTL 1.1 the project will run on source JDK 7 This is the database table DROP TABLE IF EXISTS `blogtest`.`usersprofile`; CREATE TABLE  `blogtest`.`usersprofile` (   `userid` varchar(30) NOT NULL,   `firstName` varchar(45) NOT NULL,   `lastName` varchar(45) NOT NULL,   `emailAddress` varchar(45) NOT NULL,   PRIMARY KEY (`userid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `usersprofile` VALUES ('Ahmad','Ahmad','Ahmad','Ahmad@gmail.com'), ('Ahmad1','Ahmad1','Ahmad1','Ahmad1@gmail.com'), ('Ahmad10','Ahmad10','Ahmad10','Ahmad10@gmail.com'), ('Ahmad11...

Cannot Serialize The Data Table - Web Service

System.InvalidOperationException: There was an error generating the XML document. --->  System.InvalidOperationException: Cannot serialize the DataTable. DataTable name is not set. The error will occur when you create a method in web service (.asmx file) with return type " DataTable ". For Example like below:     [WebMethod]     public DataTable test1()     {         DataTable testTable = new DataTable();         return testTable;     } The Example above will lead to the Error " Cannot Serialize The Data Table " This error because the method in WebService tries to return the result of DataTable to the client, but the DataTable does not have their own name. So the quick solution for this error has put the name for DataTable like example : The Solutions      [WebMethod]      public DataTable test1()   ...

Send email from code behind - Kentico Xperience CMS

Overview Sometimes when developing websites you may need to send emails to recipients depends on the scenario. For example, your client wants to have integration with a 3rd party system. So you did an integration and the client want every time the integration failed, send an email to the web editor to check. So how you can achieve this in Kentico Xperience CMS. Create an Email Template. First, you need to have an email template in Kentico Xperience CMS. You can do this by open the Email Template module and create a new template. The steps described in this link .