4 Replies - 2494 Views - Last Post: 19 September 2012 - 08:05 AM

#1 maram_al  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 04-August 12

my application step i do not know the problem

Posted 19 September 2012 - 04:07 AM

i am new developer of android i have problem when i run my application and it is step unfortunately
the idea of my application the user click in buttons and then it will display all course that is in mysql data base
and if he click on the specific course it will display the information of it i use (php - wamp server - josn - java)

so her is my php code that

db_config.php in folder SmsPhp
    <?php

/*
 * All database connection variables
 */

define('DB_USER', "root"); // db user
define('DB_PASSWORD', ""); // db password (mention your db password here)
define('DB_DATABASE', "sms"); // database name
define('DB_SERVER', "localhost"); // db server
?>




and db_connect.php



<?php

/**
 * A class file to connect to database
 */
class DB_CONNECT {

    // constructor
    function __construct() {
        // connecting to database
        $this->connect();
    }

    // destructor
    function __destruct() {
        // closing db connection
        $this->close();
    }

    /**
     * Function to connect with database
     */
    function connect() {
        // import database connection variables
        require_once __DIR__ . '/db_config.php';

        // Connecting to mysql database
        $con = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD) or die(mysql_error());

        // Selecing database
        $db = mysql_select_db(DB_DATABASE) or die(mysql_error()) or die(mysql_error());

        // returing connection cursor
        return $con;
    }

    /**
     * Function to close db connection
     */
    function close() {
        // closing db connection
        mysql_close();
    }

}

?>


and view_all_course.php

<?php

/*
 * Following code will list all the course
 */
 
// array for JSON response
$response = array();
 
// include db connect class
require_once __DIR__ . '/db_connect.php';
 
// connecting to db
$db = new DB_CONNECT();
// get all courses from course table
$result = mysql_query("SELECT *FROM course") or die(mysql_error());
// check for empty result
if (mysql_num_rows($result) > 0)
 {
    // looping through all results
    // products node
    $response["course"] = array();
	
	 while ($row = mysql_fetch_array($result)) 
	 {
        // temp user array
              $course = array();
            $course["CourseID"] = $row["CourseID"];
			$course["Code"] = $row["Code"];
            $course["Name"] = $row["Name"];
            $course["OfficeHours"] = $row["OfficeHours"];
            $course["CreditHours"] = $row["CreditHours"];
            $course["Description"] =$row["Description"];
            $course["MaxAbsenceDays"]= $row["MaxAbsenceDays"];
			$course["ExamsDates"] = $row["ExamsDates"];
 
        // push single product into final response array
        array_push($response["course"], $course);
		// success
    $response["success"] = 1;
 
    // echoing JSON response
    echo json_encode($response);
} else {
    // no products found
    $response["success"] = 0;
    $response["message"] = "No products found";
 
    // echo no users JSON
    echo json_encode($response);
}
    }
 
 


?>



and view_course.php
<?php
 
// array for JSON response
$response = array();
 
// include db connect class
require_once __DIR__ . '/db_connect.php';
 
// connecting to db
$db = new DB_CONNECT();
// check for post data
if (isset($_GET["CourseID"]))//Determine if a variable is set and is not NULL return true or false
 {
  $CourseID = $_GET['CourseID']; // get the value
  // get a course from course table
    $result = mysql_query("SELECT *FROM course WHERE CourseID = $CourseID");//sends a unique query
  if (!empty($result)) // if not empty return false ! = true inside
  {
        // check for empty result
        if ( mysql_num_rows($result) > 0) //Retrieves the number of rows from a result set
		{
 
            $result = mysql_fetch_array($result);//Returns an array that corresponds to the fetched
 
            $course = array();
            $course["CourseID"] = $result["CourseID"];
			$course["Code"] =$result["Code"];
            $course["Name"] = $result["Name"];
            $course["OfficeHours"] = $result["OfficeHours"];
            $course["CreditHours"] = $result["CreditHours"];
            $course["Description"] = $result["Description"];
            $course["MaxAbsenceDays"]= $result["MaxAbsenceDays"];
			$course["ExamsDates"] = $result["ExamsDates"];
            // success
            $response["success"] = 1;
			// user node
            $response["course"] = array();
            array_push($response["course"],$course); //put array $course in arry response at index course
 
            // echoing JSON response
            echo json_encode($response); //Returns a string containing the JSON representation of value.
        } else {
            // no course found =0
            $response["success"] = 0;
            $response["message"] = "No course found";
 
            // echo no users JSON
            echo json_encode($response);
        }
		}
		 else {
    // required field is missing
    $response["success"] = 0;
    $response["message"] = "Required field(s) is missing";
 
    // echoing JSON response
    echo json_encode($response);
}
?>
 


in eclipse
ViewALLCourseStudent.java

package com.ksu.sms;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
 
import org.apache.http.NameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
 
import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
 


public class ViewALLCourseStudent extends ListActivity {

	// Progress Dialog
    private ProgressDialog pDialog;
 
    // Creating JSON Parser object
    JSONParser jParser = new JSONParser();
 
    ArrayList<HashMap<String, String>> coursesList;
 
    //url to get all products list
    private static String url_all_course = "http://api.androidhive.info/SmsPhp/view_all_course.php";
    // JSON Node names
    private static final String TAG_SUCCESS = "success";
    private static final String TAG_course = "course";
    private static final String TAG_CourseID = "CourseID";
    private static final String TAG_Name = "Name";
 
    // products JSONArray
    JSONArray courses = null;
 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.view_all_course_student);


        coursesList = new ArrayList<HashMap<String, String>>();
 
        // Loading courses in Background Thread
        new LoadAllCourses().execute();
 
        // Get list view
        ListView lv = getListView();
     // on seleting single course
        // launching Edit course Screen
        lv.setOnItemClickListener(new OnItemClickListener() {
        	
        	 public void onItemClick(AdapterView<?> parent, View view,
                     int position, long id) 
        	 {
                 // getting values from selected ListItem
                 String CourseID = ((TextView) view.findViewById(R.id.CourseID)).getText()
                         .toString();
  
                 // Starting new intent
                 Intent ViewCourseStudent = new Intent(getApplicationContext(),
                         ViewCourseStudent.class);
                 // sending Course ID to next activity
                 ViewCourseStudent.putExtra(TAG_CourseID, CourseID);
  
                 // starting new activity and expecting some response back
                 startActivityForResult(ViewCourseStudent, 100);
             }
         });
  
     }
 // Response from view course Activity
    
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data)
    {
        super.onActivityResult(requestCode, resultCode, data);
        // if result code 100
        if (resultCode == 100) {
            // if result code 100 is received
            // means user view course
            // reload this screen again
            Intent intent = getIntent();
            finish();
            startActivity(intent);
        }
 
}
    /**
     * Background Async Task to Load all course by making HTTP Request
     * */
    class LoadAllCourses extends AsyncTask<String, String, String>
    {
 
        /**
         * Before starting background thread Show Progress Dialog
         * */
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pDialog = new ProgressDialog(ViewALLCourseStudent.this);
            pDialog.setMessage("Loading Courses. Please wait...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(false);
            pDialog.show();
        }
        /**
         * getting All products from u r l
         * */
		@Override
		protected String doInBackground(String... args) {
	        // Building Parameters
	        List<NameValuePair> params = new ArrayList<NameValuePair>();
	        // getting JSON string from URL
	        JSONObject json = jParser.makeHttpRequest(url_all_course, "GET", params);

	        // Check your log cat for JSON response
	        Log.d("All courses: ", json.toString());

	        try {
	            // Checking for SUCCESS TAG
	            int success = json.getInt(TAG_SUCCESS);

	            if (success == 1) {
	                // course found
	                // Getting Array of Products
	            	courses = json.getJSONArray(TAG_course);

	                // looping through All courses
	                for (int i = 0; i < courses.length(); i++)
	                {
	                    JSONObject c = courses.getJSONObject(i); // read first

	                    // Storing each json item in variable
	                    String CourseID = c.getString(TAG_CourseID);
	                    String Name = c.getString(TAG_Name);

	                    // creating new HashMap
	                    HashMap<String, String> map = new HashMap<String, String>();

	                    // adding each child node to HashMap key => value
	                    map.put(TAG_CourseID, CourseID);
	                    map.put(TAG_Name, Name);

	                    // adding HashList to ArrayList
	                    coursesList.add(map);
	                }
	            } else {
	            	Context context = getApplicationContext();
	            	CharSequence text = "No Course Found";
	            	int duration = Toast.LENGTH_LONG;
	            	Toast toast = Toast.makeText(context, text, duration);
	            	toast.show();
	            	
	            	
	            }
	        } catch (JSONException e) {
	            e.printStackTrace();
	        }

	        return null;
		}   
    
		/**
         * After completing background task Dismiss the progress dialog
         * **/
        protected void onPostExecute(String file_url) {
            // dismiss the dialog after getting all products
            pDialog.dismiss();
            // updating UI from Background Thread
            runOnUiThread(new Runnable() {
                public void run() {
                    /**
                     * Updating parsed JSON data into ListView
                     * */
                    ListAdapter adapter = new SimpleAdapter(
                            ViewALLCourseStudent.this, coursesList,
                            R.layout.list_item, new String[] { TAG_CourseID,
                            		TAG_Name},
                            new int[] { R.id.CourseID, R.id.Name });
                    // updating listview
                    setListAdapter(adapter);
                }
            });
 
        }
 
    }
}


and ViewCourseStudent.java
package com.ksu.sms;

import android.app.Activity;
import java.util.ArrayList;
import java.util.List;
 
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;


public class ViewCourseStudent extends Activity {
	TextView Name; TextView Description;
	TextView OfficeHours;
	TextView CreditHours;
	TextView MaxAbsenceDays;
	TextView ExamsDates ;
	
	    String CourseID ;
	    // Progress Dialog
	    private ProgressDialog pDialog;
	 
	    // JSON parser class
	    JSONParser jsonParser = new JSONParser();
	 
	    // single course url
	    private static final String url_course_detials = "http://api.androidhive.info/SmsPhp/view_course.php";
	    //JSON Node names
	    private static final String TAG_SUCCESS = "success";
	    private static final String TAG_CourseID = "CourseID";
	    private static final String TAG_course = "course";
	    private static final String TAG_Name = "Name";
	    private static final String TAG_OfficeHours = "OfficeHours";
	    private static final String TAG_CreditHours = "CreditHours";
	    private static final String TAG_Description = "Description";
	    private static final String TAG_MaxAbsenceDays = "MaxAbsenceDays";
	    private static final String TAG_ExamsDates = "ExamsDates";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.view_course);
        
        Intent i = getIntent();
         CourseID = i.getStringExtra(TAG_CourseID);
         // Getting complete course details in background thread
         new GetCourseDetails().execute();

    }
    
    /**
     * Background Async Task to Get complete course details
     * */
    class GetCourseDetails extends AsyncTask<String, String, String> {
 
        /**
         * Before starting background thread Show Progress Dialog
         * */
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pDialog = new ProgressDialog(ViewCourseStudent.this);
            pDialog.setMessage("Loading course details. Please wait...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(true);
            pDialog.show();
        }
        
     
	@Override
	protected String doInBackground(String... arg0) {
		// updating UI from Background Thread
        runOnUiThread(new Runnable() {
            public void run() {
                // Check for success tag
                int success;
                try {
                    // Building Parameters
                    List<NameValuePair> params = new ArrayList<NameValuePair>();
                    params.add(new BasicNameValuePair("CourseID", CourseID));

                    // getting product details by making HTTP request
                    // Note that product details url will use GET request
                    JSONObject json = jsonParser.makeHttpRequest(
                    		url_course_detials, "GET", params);

                    // check your log for json response
                    Log.d("Single course Details", json.toString());

                    // json success tag
                    success = json.getInt(TAG_SUCCESS);
                    if (success == 1) {
                        // successfully received product details
                        JSONArray courseObj = json
                                .getJSONArray(TAG_course); // JSON Array

                        // get first course object from JSON Array
                        JSONObject product = courseObj.getJSONObject(0);
                        // course with this course_id found
                        // textview Text
                        /*TextView Name; TextView Description;
	TextView OfficeHours;
	TextView CreditHours;
	TextView MaxAbsenceDays;
	TextView ExamsDates ;*/
                        Name = (TextView) findViewById(R.id.C_Name);
                        Description = (TextView) findViewById(R.id.C_Des);
                        CreditHours = (TextView) findViewById(R.id.C_Hours);
                        OfficeHours=(TextView) findViewById(R.id.C_Ohour);
                        MaxAbsenceDays=(TextView) findViewById(R.id.C_absence);
                        ExamsDates=(TextView) findViewById(R.id.Add_C_Exam);
                        // display product data in EditText
                        Name.setText(product.getString(TAG_Name));
                        Description.setText(product.getString(TAG_Description));
                        OfficeHours.setText(product.getString(TAG_OfficeHours));
                        MaxAbsenceDays.setText(product.getString(TAG_MaxAbsenceDays));
                        ExamsDates.setText(product.getString(TAG_ExamsDates));
                        CreditHours.setText(product.getString(TAG_CreditHours));

                    }else{
                        // course with course id not found
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        });

        return null;
    }

    /**
     * After completing background task Dismiss the progress dialog
     * **/
    protected void onPostExecute(String file_url) {
        // dismiss the dialog once got all details
        pDialog.dismiss();
    }
}
}


any question or any thing i can explained
my code i smliar of
this
http://www.androidhi...with-php-mysql/
thanks so much

Is This A Good Question/Topic? 0
  • +

Replies To: my application step i do not know the problem

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10779
  • View blog
  • Posts: 40,135
  • Joined: 27-December 08

Re: my application step i do not know the problem

Posted 19 September 2012 - 05:11 AM

What specific problems or errors are you encountering?
Was This Post Helpful? 0
  • +
  • -

#3 maram_al  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 04-August 12

Re: my application step i do not know the problem

Posted 19 September 2012 - 05:20 AM

View Postmacosxnerd101, on 19 September 2012 - 05:11 AM, said:

What specific problems or errors are you encountering?


after the run i click to import all course then the application close
this is the logcat

09-12 03:00:14.793: I/dalvikvm-heap(1717): Grow heap (frag case) to 12.205MB for 2530816-byte allocation
09-12 03:00:14.973: D/dalvikvm(1717): GC_CONCURRENT freed 1K, 3% free 12411K/12679K, paused 6ms+4ms
09-12 03:00:16.664: D/gralloc_goldfish(1717): Emulator without GPU emulation detected.
09-12 03:02:40.264: W/IInputConnectionWrapper(1717): showStatusIcon on inactive InputConnection
09-12 03:05:37.336: D/dalvikvm(1717): GC_FOR_ALLOC freed 53K, 2% free 12566K/12743K, paused 67ms
09-12 03:05:37.404: I/dalvikvm-heap(1717): Grow heap (frag case) to 14.768MB for 2530816-byte allocation
09-12 03:05:37.654: D/dalvikvm(1717): GC_CONCURRENT freed 66K, 2% free 14971K/15239K, paused 10ms+5ms
09-12 03:05:38.754: W/TextLayoutCache(1717): computeValuesWithHarfbuzz -- need to force to single run
09-12 03:05:42.623: W/TextLayoutCache(1717): computeValuesWithHarfbuzz -- need to force to single run
09-12 03:05:56.713: E/JSON Parser(1717): Error parsing data org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
09-12 03:07:33.813: D/dalvikvm(1717): Debugger has detached; object registry had 790 entries
09-12 03:07:33.873: W/dalvikvm(1717): threadid=12: thread exiting with uncaught exception (group=0x409961f8)
09-12 03:07:38.674: E/AndroidRuntime(1717): FATAL EXCEPTION: AsyncTask #1
09-12 03:07:38.674: E/AndroidRuntime(1717): java.lang.RuntimeException: An error occured while executing doInBackground()
09-12 03:07:38.674: E/AndroidRuntime(1717): at android.os.AsyncTask$3.done(AsyncTask.java:278)
09-12 03:07:38.674: E/AndroidRuntime(1717): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
09-12 03:07:38.674: E/AndroidRuntime(1717): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
09-12 03:07:38.674: E/AndroidRuntime(1717): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
09-12 03:07:38.674: E/AndroidRuntime(1717): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
09-12 03:07:38.674: E/AndroidRuntime(1717): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
09-12 03:07:38.674: E/AndroidRuntime(1717): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
09-12 03:07:38.674: E/AndroidRuntime(1717): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
09-12 03:07:38.674: E/AndroidRuntime(1717): at java.lang.Thread.run(Thread.java:856)
09-12 03:07:38.674: E/AndroidRuntime(1717): Caused by: java.lang.NullPointerException
09-12 03:07:38.674: E/AndroidRuntime(1717): at com.ksu.sms.ViewALLCourseStudent$LoadAllCourses.doInBackground(ViewALLCourseStudent.java:134)
09-12 03:07:38.674: E/AndroidRuntime(1717): at com.ksu.sms.ViewALLCourseStudent$LoadAllCourses.doInBackground(ViewALLCourseStudent.java:1)
09-12 03:07:38.674: E/AndroidRuntime(1717): at android.os.AsyncTask$2.call(AsyncTask.java:264)
09-12 03:07:38.674: E/AndroidRuntime(1717): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
09-12 03:07:38.674: E/AndroidRuntime(1717): ... 5 more
09-12 03:07:41.824: E/WindowManager(1717): Activity com.ksu.sms.ViewALLCourseStudent has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41358be0 that was originally added here
09-12 03:07:41.824: E/WindowManager(1717): android.view.WindowLeaked: Activity com.ksu.sms.ViewALLCourseStudent has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41358be0 that was originally added here
09-12 03:07:41.824: E/WindowManager(1717): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:343)
09-12 03:07:41.824: E/WindowManager(1717): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:245)
09-12 03:07:41.824: E/WindowManager(1717): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:193)
09-12 03:07:41.824: E/WindowManager(1717): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:118)
09-12 03:07:41.824: E/WindowManager(1717): at android.view.Window$LocalWindowManager.addView(window.java:537)
09-12 03:07:41.824: E/WindowManager(1717): at android.app.Dialog.show(Dialog.java:274)
09-12 03:07:41.824: E/WindowManager(1717): at com.ksu.sms.ViewALLCourseStudent$LoadAllCourses.onPreExecute(ViewALLCourseStudent.java:121)
09-12 03:07:41.824: E/WindowManager(1717): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:561)
09-12 03:07:41.824: E/WindowManager(1717): at android.os.AsyncTask.execute(AsyncTask.java:511)
09-12 03:07:41.824: E/WindowManager(1717): at com.ksu.sms.ViewALLCourseStudent.onCreate(ViewALLCourseStudent.java:62)
09-12 03:07:41.824: E/WindowManager(1717): at android.app.Activity.performCreate(Activity.java:4465)
09-12 03:07:41.824: E/WindowManager(1717): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
09-12 03:07:41.824: E/WindowManager(1717): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
09-12 03:07:41.824: E/WindowManager(1717): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
09-12 03:07:41.824: E/WindowManager(1717): at android.app.ActivityThread.access$600(ActivityThread.java:122)
09-12 03:07:41.824: E/WindowManager(1717): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
09-12 03:07:41.824: E/WindowManager(1717): at android.os.Handler.dispatchMessage(Handler.java:99)
09-12 03:07:41.824: E/WindowManager(1717): at android.os.Looper.loop(Looper.java:137)
09-12 03:07:41.824: E/WindowManager(1717): at android.app.ActivityThread.main(ActivityThread.java:4340)
09-12 03:07:41.824: E/WindowManager(1717): at java.lang.reflect.Method.invokeNative(Native Method)
09-12 03:07:41.824: E/WindowManager(1717): at java.lang.reflect.Method.invoke(Method.java:511)
09-12 03:07:41.824: E/WindowManager(1717): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-12 03:07:41.824: E/WindowManager(1717): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-12 03:07:41.824: E/WindowManager(1717): at dalvik.system.NativeStart.main(Native Method)
09-12 03:07:56.495: D/dalvikvm(1834): GC_FOR_ALLOC freed 55K, 3% free 9940K/10179K, paused 92ms
09-12 03:07:56.553: I/dalvikvm-heap(1834): Grow heap (frag case) to 12.205MB for 2530816-byte allocation
09-12 03:07:56.725: D/dalvikvm(1834): GC_CONCURRENT freed 1K, 3% free 12410K/12679K, paused 4ms+19ms
09-12 03:07:57.523: D/gralloc_goldfish(1834): Emulator without GPU emulation detected.
09-12 03:08:32.985: D/dalvikvm(1834): GC_FOR_ALLOC freed 26K, 2% free 12496K/12679K, paused 139ms
09-12 03:08:33.058: I/dalvikvm-heap(1834): Grow heap (frag case) to 14.700MB for 2530816-byte allocation
09-12 03:08:33.294: D/dalvikvm(1834): GC_CONCURRENT freed 3K, 2% free 14964K/15175K, paused 5ms+8ms
09-12 03:08:34.114: W/TextLayoutCache(1834): computeValuesWithHarfbuzz -- need to force to single run
09-12 03:08:36.973: W/TextLayoutCache(1834): computeValuesWithHarfbuzz -- need to force to single run
09-12 03:08:39.653: E/JSON Parser(1834): Error parsing data org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
09-12 03:08:39.743: W/dalvikvm(1834): threadid=11: thread exiting with uncaught exception (group=0x409961f8)
09-12 03:08:39.853: E/AndroidRuntime(1834): FATAL EXCEPTION: AsyncTask #1
09-12 03:08:39.853: E/AndroidRuntime(1834): java.lang.RuntimeException: An error occured while executing doInBackground()
09-12 03:08:39.853: E/AndroidRuntime(1834): at android.os.AsyncTask$3.done(AsyncTask.java:278)
09-12 03:08:39.853: E/AndroidRuntime(1834): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
09-12 03:08:39.853: E/AndroidRuntime(1834): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
09-12 03:08:39.853: E/AndroidRuntime(1834): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
09-12 03:08:39.853: E/AndroidRuntime(1834): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
09-12 03:08:39.853: E/AndroidRuntime(1834): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
09-12 03:08:39.853: E/AndroidRuntime(1834): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
09-12 03:08:39.853: E/AndroidRuntime(1834): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
09-12 03:08:39.853: E/AndroidRuntime(1834): at java.lang.Thread.run(Thread.java:856)
09-12 03:08:39.853: E/AndroidRuntime(1834): Caused by: java.lang.NullPointerException
09-12 03:08:39.853: E/AndroidRuntime(1834): at com.ksu.sms.ViewALLCourseStudent$LoadAllCourses.doInBackground(ViewALLCourseStudent.java:135)
09-12 03:08:39.853: E/AndroidRuntime(1834): at com.ksu.sms.ViewALLCourseStudent$LoadAllCourses.doInBackground(ViewALLCourseStudent.java:1)
09-12 03:08:39.853: E/AndroidRuntime(1834): at android.os.AsyncTask$2.call(AsyncTask.java:264)
09-12 03:08:39.853: E/AndroidRuntime(1834): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
09-12 03:08:39.853: E/AndroidRuntime(1834): ... 5 more
09-12 03:08:41.843: E/WindowManager(1834): Activity com.ksu.sms.ViewALLCourseStudent has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@418706c8 that was originally added here
09-12 03:08:41.843: E/WindowManager(1834): android.view.WindowLeaked: Activity com.ksu.sms.ViewALLCourseStudent has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@418706c8 that was originally added here
09-12 03:08:41.843: E/WindowManager(1834): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:343)
09-12 03:08:41.843: E/WindowManager(1834): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:245)
09-12 03:08:41.843: E/WindowManager(1834): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:193)
09-12 03:08:41.843: E/WindowManager(1834): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:118)
09-12 03:08:41.843: E/WindowManager(1834): at android.view.Window$LocalWindowManager.addView(window.java:537)
09-12 03:08:41.843: E/WindowManager(1834): at android.app.Dialog.show(Dialog.java:274)
09-12 03:08:41.843: E/WindowManager(1834): at com.ksu.sms.ViewALLCourseStudent$LoadAllCourses.onPreExecute(ViewALLCourseStudent.java:122)
09-12 03:08:41.843: E/WindowManager(1834): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:561)
09-12 03:08:41.843: E/WindowManager(1834): at android.os.AsyncTask.execute(AsyncTask.java:511)
09-12 03:08:41.843: E/WindowManager(1834): at com.ksu.sms.ViewALLCourseStudent.onCreate(ViewALLCourseStudent.java:62)
09-12 03:08:41.843: E/WindowManager(1834): at android.app.Activity.performCreate(Activity.java:4465)
09-12 03:08:41.843: E/WindowManager(1834): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
09-12 03:08:41.843: E/WindowManager(1834): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
09-12 03:08:41.843: E/WindowManager(1834): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
09-12 03:08:41.843: E/WindowManager(1834): at android.app.ActivityThread.access$600(ActivityThread.java:122)
09-12 03:08:41.843: E/WindowManager(1834): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
09-12 03:08:41.843: E/WindowManager(1834): at android.os.Handler.dispatchMessage(Handler.java:99)
09-12 03:08:41.843: E/WindowManager(1834): at android.os.Looper.loop(Looper.java:137)
09-12 03:08:41.843: E/WindowManager(1834): at android.app.ActivityThread.main(ActivityThread.java:4340)
09-12 03:08:41.843: E/WindowManager(1834): at java.lang.reflect.Method.invokeNative(Native Method)
09-12 03:08:41.843: E/WindowManager(1834): at java.lang.reflect.Method.invoke(Method.java:511)
09-12 03:08:41.843: E/WindowManager(1834): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-12 03:08:41.843: E/WindowManager(1834): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-12 03:08:41.843: E/WindowManager(1834): at dalvik.system.NativeStart.main(Native Method)
09-12 03:13:40.228: I/Process(1834): Sending signal. PID: 1834 SIG: 9
09-12 03:13:41.963: D/dalvikvm(1851): GC_FOR_ALLOC freed 58K, 3% free 9941K/10179K, paused 86ms
09-12 03:13:42.015: I/dalvikvm-heap(1851): Grow heap (frag case) to 12.205MB for 2530816-byte allocation
09-12 03:13:42.253: D/dalvikvm(1851): GC_CONCURRENT freed 1K, 3% free 12411K/12679K, paused 9ms+7ms
09-12 03:13:42.893: D/gralloc_goldfish(1851): Emulator without GPU emulation detected.
09-12 04:44:39.194: D/dalvikvm(1851): GC_FOR_ALLOC freed 32K, 2% free 12497K/12679K, paused 121ms
09-12 04:44:39.274: I/dalvikvm-heap(1851): Grow heap (frag case) to 14.701MB for 2530816-byte allocation
09-12 04:44:39.454: D/dalvikvm(1851): GC_CONCURRENT freed 3K, 2% free 14965K/15175K, paused 6ms+6ms
09-12 04:44:40.174: W/TextLayoutCache(1851): computeValuesWithHarfbuzz -- need to force to single run
09-12 04:44:43.234: W/TextLayoutCache(1851): computeValuesWithHarfbuzz -- need to force to single run
09-12 04:44:45.983: E/JSON Parser(1851): Error parsing data org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
09-12 04:44:45.983: W/dalvikvm(1851): threadid=12: thread exiting with uncaught exception (group=0x409961f8)
09-12 04:44:46.103: E/AndroidRuntime(1851): FATAL EXCEPTION: AsyncTask #1
09-12 04:44:46.103: E/AndroidRuntime(1851): java.lang.RuntimeException: An error occured while executing doInBackground()
09-12 04:44:46.103: E/AndroidRuntime(1851): at android.os.AsyncTask$3.done(AsyncTask.java:278)
09-12 04:44:46.103: E/AndroidRuntime(1851): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
09-12 04:44:46.103: E/AndroidRuntime(1851): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
09-12 04:44:46.103: E/AndroidRuntime(1851): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
09-12 04:44:46.103: E/AndroidRuntime(1851): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
09-12 04:44:46.103: E/AndroidRuntime(1851): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
09-12 04:44:46.103: E/AndroidRuntime(1851): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
09-12 04:44:46.103: E/AndroidRuntime(1851): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
09-12 04:44:46.103: E/AndroidRuntime(1851): at java.lang.Thread.run(Thread.java:856)
09-12 04:44:46.103: E/AndroidRuntime(1851): Caused by: java.lang.NullPointerException
09-12 04:44:46.103: E/AndroidRuntime(1851): at com.ksu.sms.ViewALLCourseStudent$LoadAllCourses.doInBackground(ViewALLCourseStudent.java:135)
09-12 04:44:46.103: E/AndroidRuntime(1851): at com.ksu.sms.ViewALLCourseStudent$LoadAllCourses.doInBackground(ViewALLCourseStudent.java:1)
09-12 04:44:46.103: E/AndroidRuntime(1851): at android.os.AsyncTask$2.call(AsyncTask.java:264)
09-12 04:44:46.103: E/AndroidRuntime(1851): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
09-12 04:44:46.103: E/AndroidRuntime(1851): ... 5 more
09-12 04:44:47.793: E/WindowManager(1851): Activity com.ksu.sms.ViewALLCourseStudent has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41870bd8 that was originally added here
09-12 04:44:47.793: E/WindowManager(1851): android.view.WindowLeaked: Activity com.ksu.sms.ViewALLCourseStudent has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41870bd8 that was originally added here
09-12 04:44:47.793: E/WindowManager(1851): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:343)
09-12 04:44:47.793: E/WindowManager(1851): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:245)
09-12 04:44:47.793: E/WindowManager(1851): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:193)
09-12 04:44:47.793: E/WindowManager(1851): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:118)
09-12 04:44:47.793: E/WindowManager(1851): at android.view.Window$LocalWindowManager.addView(window.java:537)
09-12 04:44:47.793: E/WindowManager(1851): at android.app.Dialog.show(Dialog.java:274)
09-12 04:44:47.793: E/WindowManager(1851): at com.ksu.sms.ViewALLCourseStudent$LoadAllCourses.onPreExecute(ViewALLCourseStudent.java:122)
09-12 04:44:47.793: E/WindowManager(1851): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:561)
09-12 04:44:47.793: E/WindowManager(1851): at android.os.AsyncTask.execute(AsyncTask.java:511)
09-12 04:44:47.793: E/WindowManager(1851): at com.ksu.sms.ViewALLCourseStudent.onCreate(ViewALLCourseStudent.java:62)
09-12 04:44:47.793: E/WindowManager(1851): at android.app.Activity.performCreate(Activity.java:4465)
09-12 04:44:47.793: E/WindowManager(1851): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
09-12 04:44:47.793: E/WindowManager(1851): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
09-12 04:44:47.793: E/WindowManager(1851): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
09-12 04:44:47.793: E/WindowManager(1851): at android.app.ActivityThread.access$600(ActivityThread.java:122)
09-12 04:44:47.793: E/WindowManager(1851): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
09-12 04:44:47.793: E/WindowManager(1851): at android.os.Handler.dispatchMessage(Handler.java:99)
09-12 04:44:47.793: E/WindowManager(1851): at android.os.Looper.loop(Looper.java:137)
09-12 04:44:47.793: E/WindowManager(1851): at android.app.ActivityThread.main(ActivityThread.java:4340)
09-12 04:44:47.793: E/WindowManager(1851): at java.lang.reflect.Method.invokeNative(Native Method)
09-12 04:44:47.793: E/WindowManager(1851): at java.lang.reflect.Method.invoke(Method.java:511)
09-12 04:44:47.793: E/WindowManager(1851): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-12 04:44:47.793: E/WindowManager(1851): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-12 04:44:47.793: E/WindowManager(1851): at dalvik.system.NativeStart.main(Native Method)
09-12 04:44:53.333: D/dalvikvm(1873): GC_FOR_ALLOC freed 62K, 3% free 9941K/10179K, paused 65ms
09-12 04:44:53.363: I/dalvikvm-heap(1873): Grow heap (frag case) to 12.205MB for 2530816-byte allocation
09-12 04:44:53.553: D/dalvikvm(1873): GC_CONCURRENT freed 1K, 3% free 12411K/12679K, paused 10ms+4ms
09-12 04:44:54.003: D/gralloc_goldfish(1873): Emulator without GPU emulation detected.
09-12 04:48:49.424: W/IInputConnectionWrapper(1873): showStatusIcon on inactive InputConnection
09-12 04:50:35.114: D/dalvikvm(1873): GC_FOR_ALLOC freed 59K, 2% free 12567K/12743K, paused 54ms
09-12 04:50:35.164: I/dalvikvm-heap(1873): Grow heap (frag case) to 14.769MB for 2530816-byte allocation
09-12 04:50:35.374: D/dalvikvm(1873): GC_CONCURRENT freed 69K, 2% free 14968K/15239K, paused 21ms+7ms
09-12 04:50:35.904: W/TextLayoutCache(1873): computeValuesWithHarfbuzz -- need to force to single run
09-12 04:50:38.523: W/TextLayoutCache(1873): computeValuesWithHarfbuzz -- need to force to single run
09-12 04:50:55.624: E/JSON Parser(1873): Error parsing data org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
09-12 04:50:55.634: W/dalvikvm(1873): threadid=11: thread exiting with uncaught exception (group=0x409961f8)
09-12 04:50:55.764: E/AndroidRuntime(1873): FATAL EXCEPTION: AsyncTask #1
09-12 04:50:55.764: E/AndroidRuntime(1873): java.lang.RuntimeException: An error occured while executing doInBackground()
09-12 04:50:55.764: E/AndroidRuntime(1873): at android.os.AsyncTask$3.done(AsyncTask.java:278)
09-12 04:50:55.764: E/AndroidRuntime(1873): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
09-12 04:50:55.764: E/AndroidRuntime(1873): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
09-12 04:50:55.764: E/AndroidRuntime(1873): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
09-12 04:50:55.764: E/AndroidRuntime(1873): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
09-12 04:50:55.764: E/AndroidRuntime(1873): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
09-12 04:50:55.764: E/AndroidRuntime(1873): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
09-12 04:50:55.764: E/AndroidRuntime(1873): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
09-12 04:50:55.764: E/AndroidRuntime(1873): at java.lang.Thread.run(Thread.java:856)
09-12 04:50:55.764: E/AndroidRuntime(1873): Caused by: java.lang.NullPointerException
09-12 04:50:55.764: E/AndroidRuntime(1873): at com.ksu.sms.ViewALLCourseStudent$LoadAllCourses.doInBackground(ViewALLCourseStudent.java:135)
09-12 04:50:55.764: E/AndroidRuntime(1873): at com.ksu.sms.ViewALLCourseStudent$LoadAllCourses.doInBackground(ViewALLCourseStudent.java:1)
09-12 04:50:55.764: E/AndroidRuntime(1873): at android.os.AsyncTask$2.call(AsyncTask.java:264)
09-12 04:50:55.764: E/AndroidRuntime(1873): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
09-12 04:50:55.764: E/AndroidRuntime(1873): ... 5 more
09-12 04:50:57.614: E/WindowManager(1873): Activity com.ksu.sms.ViewALLCourseStudent has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4133e728 that was originally added here
09-12 04:50:57.614: E/WindowManager(1873): android.view.WindowLeaked: Activity com.ksu.sms.ViewALLCourseStudent has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4133e728 that was originally added here
09-12 04:50:57.614: E/WindowManager(1873): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:343)
09-12 04:50:57.614: E/WindowManager(1873): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:245)
09-12 04:50:57.614: E/WindowManager(1873): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:193)
09-12 04:50:57.614: E/WindowManager(1873): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:118)
09-12 04:50:57.614: E/WindowManager(1873): at android.view.Window$LocalWindowManager.addView(window.java:537)
09-12 04:50:57.614: E/WindowManager(1873): at android.app.Dialog.show(Dialog.java:274)
09-12 04:50:57.614: E/WindowManager(1873): at com.ksu.sms.ViewALLCourseStudent$LoadAllCourses.onPreExecute(ViewALLCourseStudent.java:122)
09-12 04:50:57.614: E/WindowManager(1873): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:561)
09-12 04:50:57.614: E/WindowManager(1873): at android.os.AsyncTask.execute(AsyncTask.java:511)
09-12 04:50:57.614: E/WindowManager(1873): at com.ksu.sms.ViewALLCourseStudent.onCreate(ViewALLCourseStudent.java:62)
09-12 04:50:57.614: E/WindowManager(1873): at android.app.Activity.performCreate(Activity.java:4465)
09-12 04:50:57.614: E/WindowManager(1873): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
09-12 04:50:57.614: E/WindowManager(1873): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
09-12 04:50:57.614: E/WindowManager(1873): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
09-12 04:50:57.614: E/WindowManager(1873): at android.app.ActivityThread.access$600(ActivityThread.java:122)
09-12 04:50:57.614: E/WindowManager(1873): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
09-12 04:50:57.614: E/WindowManager(1873): at android.os.Handler.dispatchMessage(Handler.java:99)
09-12 04:50:57.614: E/WindowManager(1873): at android.os.Looper.loop(Looper.java:137)
09-12 04:50:57.614: E/WindowManager(1873): at android.app.ActivityThread.main(ActivityThread.java:4340)
09-12 04:50:57.614: E/WindowManager(1873): at java.lang.reflect.Method.invokeNative(Native Method)
09-12 04:50:57.614: E/WindowManager(1873): at java.lang.reflect.Method.invoke(Method.java:511)
09-12 04:50:57.614: E/WindowManager(1873): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-12 04:50:57.614: E/WindowManager(1873): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-12 04:50:57.614: E/WindowManager(1873): at dalvik.system.NativeStart.main(Native Method)
09-12 04:50:59.144: I/Process(1873): Sending signal. PID: 1873 SIG: 9
09-12 04:51:00.054: D/dalvikvm(1916): GC_FOR_ALLOC freed 65K, 3% free 9941K/10179K, paused 104ms
09-12 04:51:00.124: I/dalvikvm-heap(1916): Grow heap (frag case) to 12.205MB for 2530816-byte allocation
09-12 04:51:00.314: D/dalvikvm(1916): GC_CONCURRENT freed 1K, 3% free 12411K/12679K, paused 9ms+18ms
09-12 04:51:00.844: D/gralloc_goldfish(1916): Emulator without GPU emulation detected.
Was This Post Helpful? 0
  • +
  • -

#4 maram_al  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 04-August 12

Re: my application step i do not know the problem

Posted 19 September 2012 - 07:39 AM

i solve the problem
but know i have this problem
Error parsing data org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject

This post has been edited by macosxnerd101: 19 September 2012 - 08:41 AM
Reason for edit:: Please avoid quoting posts of excessive length

Was This Post Helpful? 0
  • +
  • -

#5 H3R3T1C  Icon User is offline

  • Android Expert
  • member icon

Reputation: 277
  • View blog
  • Posts: 757
  • Joined: 30-March 07

Re: my application step i do not know the problem

Posted 19 September 2012 - 08:05 AM

If you are getting that error then your returned data may not be a json string. You may have to manually download the string then pass it to the json parser. Here is some code to download the response: http://stackoverflow.com/a/1162589
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1