Tuesday, 21 March 2017

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

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...