Tuesday 17 December 2019

Android Execute Asyntask within another class from another class

I have a class inside which there is another class that extends AsyncTask. As,



public class Dashboard extends Activity {
-------------
--------------
--------------

public class getUnreadMessageCount extends AsyncTask {
protected JSONObject doInBackground(){
*********some database stuff************
}
protected void onPostExecute(JSONObject json) {
count = Integer.parseInt(json.getString("messsage_count"));
// Set Text to the textview
messageCount.setText(count);
}


}
}


Now I am using GCMIntentService Class for notification. How can I call and execute the getUnreadMessageCount in the following



private void sendNotification(String content_id, int type, String msg) {

}



I tried as



private void sendNotification(String content_id, int type, String msg) {
Dashboard dashboard = new Dashboard;
dashboard.Dashboard dashboard----
}


But it does not work. How could I solve this problem.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...