I have an AsyncTask
, I want to set Text of TextView
in my layout.xml file, but my Application is Crashed with Error this
android.content.res.Resources$NotFoundException: String resource ID #0x2
kindly help me!
public class UploadVideo extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
transferUtility = Util.getTransferUtility(this);
requestWindowFeature(getWindow().FEATURE_NO_TITLE);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.my_activity);
context = this;
new get_people_data().execute();
}
public class get_people_data extends AsyncTask<String,String,String>{
final String TAG = "get_people_data";
String API_URL = "http://api.expressionsapp.com/users/auth0_5732cc152781665b7b5dfee6/status/";
int front;
int behind;
@Override
protected String doInBackground(String...arg0)
{
try
{
JsonParser jParser = new JsonParser();
JSONObject json = jParser.getJSONFromUrl(API_URL);
behind= json.getInt("countBack");
front= json.getInt("countFront");
}catch (JSONException e)
{
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(String s)
{
TextView ppl_infront;
TextView ppl_behind;
ppl_infront = (TextView) findViewById(R.id.ppl_infront);
ppl_infront.setText(front);
ppl_behind = (TextView) findViewById(R.id.ppl_behind);
ppl_behind.setText(behind);
}
}
}