Android: NoSuchElementException

This is one of the class of my Android project . I am getting a NoSuchElementException . When I comment the Two StringTokenizer ‘s along with the st.nextToken() & st1.nextToken() the app runs fine.
Please help
package com.example.client_nic;

import java.util.Calendar;
import java.util.StringTokenizer;

import com.example.client_nic.DataFields.fields;

import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;

import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class Meeting extends Fragment {

    public View onCreateView(LayoutInflater inflater,
            @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        View view = inflater.inflate(R.layout.clientmeeting, container,false);  //why false still unclear
        EditText nameev= (EditText)view.findViewById(;
        final String name = nameev.getText().toString();
            Toast.makeText(getActivity(), "Name cannot be Empty", Toast.LENGTH_SHORT).show();


        EditText contactev= (EditText)view.findViewById(;
        final String contact = contactev.getText().toString();

        EditText addressev= (EditText)view.findViewById(;
        final String address = addressev.getText().toString();

        EditText remarksev= (EditText)view.findViewById(;
        final String remarks = remarksev.getText().toString();

        EditText dateev = (EditText)view.findViewById(;
        final String date = dateev.getText().toString();
        StringTokenizer st = new StringTokenizer(date, "/");

        final int day = Integer.parseInt(st.nextToken());
        final int month = Integer.parseInt(st.nextToken());
        final int year = Integer.parseInt(st.nextToken());

        EditText timeev = (EditText)view.findViewById(;
        final String time = timeev.getText().toString();

        StringTokenizer st1 = new StringTokenizer(time, ":");
        final int hourOfDay  = Integer.parseInt(st1.nextToken());
        final int minute = Integer.parseInt(st1.nextToken());

        Button button = (Button)view.findViewById(;
        button.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                // TODO Auto-generated method stub

                Calendar calender = Calendar.getInstance();
                calender.set(year, month, day, hourOfDay, minute);
                long inputtime = calender.getTimeInMillis();

                long presenttime = System.currentTimeMillis();
                    Toast.makeText(getActivity(), "Time has already passed", Toast.LENGTH_SHORT).show();

                String insert = "INSERT INTO "+fields.table_name+" VALUES('"+name+"','"+contact+"','"+address+"','"+remarks+"','"+date+"','"+time+"' ) ";                   

                Datastore ds = new Datastore(getActivity());
                SQLiteDatabase sql = ds.getWritableDatabase();

        return view;



Source: android

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.