本文整理汇总了Java中com.kosalgeek.genasync12.PostResponseAsyncTask.execute方法的典型用法代码示例。如果您正苦于以下问题:Java PostResponseAsyncTask.execute方法的具体用法?Java PostResponseAsyncTask.execute怎么用?Java PostResponseAsyncTask.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.kosalgeek.genasync12.PostResponseAsyncTask
的用法示例。
在下文中一共展示了PostResponseAsyncTask.execute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityResult
import com.kosalgeek.genasync12.PostResponseAsyncTask; //导入方法依赖的package包/类
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST && resultCode == Activity.RESULT_OK) {
photo = (Bitmap) data.getExtras().get("data");
ByteArrayOutputStream baos=new ByteArrayOutputStream();
photo.compress(Bitmap.CompressFormat.PNG,100, baos);
byte [] b=baos.toByteArray();
temp=Base64.encodeToString(b, Base64.DEFAULT);
String url = "http://192.168.4.152:5000/connect/";
HashMap postData = new HashMap();
postData.put("image", temp);
PostResponseAsyncTask readTask = new PostResponseAsyncTask(MainActivity.this, postData, new AsyncResponse() {
@Override
public void processFinish(String s) {
if (s.equals("error")){
Intent i = new Intent(MainActivity.this,AddPerson.class);
i.putExtra("pic",temp);
startActivity(i);
}else{
Intent intent = new Intent(MainActivity.this,Profile.class);
intent.putExtra("profileDetails",s);
startActivity(intent);
}
}
});
readTask.execute(url);
}
}
示例2: onCreate
import com.kosalgeek.genasync12.PostResponseAsyncTask; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_geo_location);
String url = "http://192.168.4.152:5000/alert/";
HashMap postData = new HashMap();
PostResponseAsyncTask readTask = new PostResponseAsyncTask(GeoLocation.this, postData, new AsyncResponse() {
@Override
public void processFinish(String s) {
}
});
readTask.execute(url);
}