android聊天表情,Android聊天应用程序表情符号的问题

我正在开发Android聊天应用程序。现在我想在聊天模块中发送表情符号。我如何在聊天应用程序中实现表情符号?请指导我这个应用程序。如果有这个应用程序的任何API,那么也建议我。谢谢Android聊天应用程序表情符号的问题

public void callAsynchronousTask() {

final Handler handler = new Handler();

timer = new Timer();

TimerTask doAsynchronousTask = new TimerTask() {

@Override

public void run() {

handler.post(new Runnable() {

public void run() {

try {

new GetSingleChat(Chat_Detail_Single.this).execute(friend_id);

} catch (NullPointerException e) {

}

}

});

}

};

timer.schedule(doAsynchronousTask, 1000, 1000);

}

@Override

public void onClick(View v) {

switch (v.getId()) {

case R.id.btncamera:

Dialog_Manager.chooseImage(Chat_Detail_Single.this, "singlechat");

break;

case R.id.img_back:

timer.cancel();

finish();

break;

case R.id.btnsend:

String message_ = edt_mes.getText().toString();

if (message_.replace(" ", "").length() == 0) {

} else {

edt_mes.setText("");

new Send_chat_message(Chat_Detail_Single.this).execute(SharedPref.getUserID(this), friend_id, "mes", message_);

}

break;

}

}

public static void get_chat_data(List fetch_chat) {

MyCustomList.clear();

MyCustomList.addAll(fetch_chat);

try {

if (adptor == null) {

adptor = new Single_Chat_Adap(activity,

MyCustomList);

Chat_Detail_Single.listView.setAdapter(adptor);

Chat_Detail_Single.listView.setSelection(MyCustomList

.size() - 1);

lastCount = MyCustomList.size();

} else {

if (lastCount != MyCustomList.size()) {

lastCount = MyCustomList.size();

adptor.notifyDataSetChanged();

Chat_Detail_Single.listView

.setSelection(MyCustomList.size());

}

}

} catch (NullPointerException e) {

} catch (Exception e) {

// TODO: handle exception

}

}

@Override

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

super.onActivityResult(requestCode, resultCode, data);

try {

if (requestCode == Dialog_Manager.Gallery_Intent

&& resultCode == RESULT_OK && data != null) {

File direct = new File(

Environment.getExternalStorageDirectory() + "/Fun You");

if (!direct.exists()) {

if (direct.mkdir())

;

}

long time = System.currentTimeMillis();

capturepath1 = direct.getAbsolutePath() + "/" + time + ".jpg";

File file = new File(capturepath1);

Uri outputFileUri = Uri.fromFile(file);

Uri selectedImage = data.getData();

imagePath = getPath(selectedImage);

Intent cropIntent = new Intent("com.android.camera.action.CROP");

Uri contentUri = selectedImage;

cropIntent.setDataAndType(contentUri, "image/*");

cropIntent.putExtra("crop", "true");

cropIntent.putExtra("aspectX", 1);

cropIntent.putExtra("aspectY", 1);

cropIntent.putExtra("outputX", 1000);

cropIntent.putExtra("outputY", 1000);

cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);

cropIntent.putExtra("return-data", true);

startActivityForResult(cropIntent, 3);

} else if (requestCode == Dialog_Manager.Camera_Intent

&& resultCode == RESULT_OK) {

File direct = new File(

Environment.getExternalStorageDirectory() + "/Fun You");

if (!direct.exists()) {

if (direct.mkdir())

;

}

long time = System.currentTimeMillis();

capturepath1 = direct.getAbsolutePath() + "/" + time + ".jpg";

File file = new File(capturepath1);

Uri outputFileUri = Uri.fromFile(file);

File photos = new File(imagePath);

Uri selectedImage = Uri.fromFile(photos);

Intent cropIntent = new Intent("com.android.camera.action.CROP");

Uri contentUri = selectedImage;

cropIntent.setDataAndType(contentUri, "image/*");

cropIntent.putExtra("crop", "true");

cropIntent.putExtra("aspectX", 1);

cropIntent.putExtra("aspectY", 1);

cropIntent.putExtra("outputX", 1000);

cropIntent.putExtra("outputY", 1000);

cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);

cropIntent.putExtra("return-data", true);

startActivityForResult(cropIntent, 3);

} else if (requestCode == 3) {

try {

Bitmap thumbnail = null;

Bundle extras = data.getExtras();

if (extras != null) {

thumbnail = extras.getParcelable("data");

Bitmap bm = thumbnail;

bm = ExtraMethods.decodeFile(capturepath1);

bm = ExifUtils.rotateBitmap(capturepath1, bm);

// new Uplaod_image().execute(capturepath1);

new Send_chat_message(Chat_Detail_Single.this).execute(SharedPref.getUserID(this), friend_id, "image", capturepath1);

}

} catch (Exception e) {

e.printStackTrace();

}

}

} catch (Exception e) {

Toast.makeText(getApplicationContext(), e + "", Toast.LENGTH_LONG)

.show();

}

}

public String getPath(Uri uri) {

if (uri == null) {

return null;

}

String[] projection = {MediaStore.Images.Media.DATA};

Cursor cursor = getContentResolver().query(uri, projection, null, null,

null);

if (cursor != null) {

int column_index = cursor

.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);

cursor.moveToFirst();

return cursor.getString(column_index);

}

return uri.getPath();

}

+0

只是某个时候回来回答了在这里本应帮助你,问笔者也提到库太 –

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值