Search the Blog

Thursday, August 15, 2019

Android Java Code form JAVA MVC Project Notice view School Application

Code of School Appolication for devliverying School Notice

This post have the code and logic and process to send the notice to all student and staff of a school. In this code i use a tomcat server mysql server

Android Java Code form JAVA MVC Project Notice view




package com.example.sawan.onlineattendance;



import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;

public class DrictorTeacherNotice extends AppCompatActivity {

 EditText ed;
 Button button;
 JSONParser jParser = new JSONParser();
 Context ctx;
 JSONObject json;
 static String buttton;
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_drictor_teacher_notice);
  ed = (EditText) findViewById(R.id.notice);
  button = (Button) findViewById(R.id.update);
  ed.setText(Identification.DrictorFacultyNotice);
  button.setOnClickListener(new View.OnClickListener() {
   @Override
   public void onClick(View view) {
    buttton = "TeacherNoticeSubmit";
    new Login().execute();
   }
  });
 }
 private class Login extends AsyncTask < String_dizsweb, String,_dizsweb String_dizsweb > {
  @SuppressWarnings("WrongThread")
  @Override
  protected String doInBackground(String...args) {
   {
    String url_login2 = "http: //192.168.43.156:8081/OnlineAttendance/DirectorNoticeServlet";
    List < NameValuePair > params_dizsweb_1 = new ArrayList < NameValuePair > ();
    params.add(new BasicNameValuePair("t", Identification.TableName));
    params.add(new BasicNameValuePair("cutoff", buttton));
    params.add(new BasicNameValuePair("text", ed.getText().toString()));
    json = jParser.makeHttpRequest(url_login2, "GET", params);
    String s = null;
    try {
     if (json.getString("info").equals("success")) {
      Intent login = new Intent(getApplicationContext(), Successful.class);
      login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      startActivity(login);
      finish();
     } else {
      Intent login = new Intent(getApplicationContext(), Error.class);
      login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      startActivity(login);
      finish();
     }
    } catch (Exception e) {
     e.printStackTrace();
    }
   }
   return null;
  }
 }
}


See Also-Pyhtan * Pattern Program with Space

No comments:

Post a Comment

Translate