public final class InJavaScriptLocalObj {
@JavascriptInterface
public void showSource ( String html ) {
System . out . println ( "====>html=" + html ) ;
String [] mSqlit = html . split ( "src" ) ;
if ( mSqlit != null ) {
if ( mSqlit . length > 10 ) {
ToastUtil . showShortToast ( activity , " 最多上传 9 个 ( 图片 + 视频 + 作品 )" ) ;
return ;
}
}
title = mTitleEdit . getText () . toString () . trim () ;
if ( CheckUtil . isNull ( title )) {
ToastUtil . showShortToast ( activity , " 请添加标题 " ) ;
return ;
}
if ( CheckUtil . isNull ( html )) {
ToastUtil . showShortToast ( activity , " 请编辑正文 " ) ;
return ;
}
ChoosePostBean itemPost = new ChoosePostBean () ;
itemPost . setContent ( html ) ;
itemPost . setTitle ( title ) ;
Bundle bundle = new Bundle () ;
bundle . putParcelable ( "post" , itemPost ) ;
startForResult ( bundle , REQUEST_SUCEESS_CODE , PostNextAty . class ) ;
}
@JavascriptInterface
public void showDescription ( final String str ) {
System . out . println ( "====>html=" + str ) ;
Message msg = mHandler . obtainMessage () ;
msg . what = 1 ;
msg . obj = str ;
mHandler . sendMessage ( msg ) ;
}
}
访问网络的数据,不能在子线程操作,做访问有关UI操作等等.........
@JavascriptInterface
public void showDescription ( final String str ) {
System . out . println ( "====>html=" + str ) ;
/**********************showDescription 深坑 ***********************/
// String text=mTitleEdit.getText().toString().trim;
// 做网络的有关操作放在 UI 线程主线程当中
String text = mTitleEdit . getText () . toString () . trim;
// 做网络的有关操作放在 UI 线程主线程当中
}