Sunday, 11 March 2018

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

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...