您好,欢迎访问三七文档
当前位置:首页 > 办公文档 > 工作范文 > 计算机软件著作权登记-源代码范本
基于Android“说呀”聊天辅助系统V1.0源代码1packagecom.example.shuoya;importjava.util.Set;importandroid.content.BroadcastReceiver;importandroid.content.Context;importandroid.content.Intent;importandroid.database.Cursor;importandroid.database.sqlite.SQLiteDatabase;importandroid.os.Bundle;importandroid.telephony.SmsMessage;importandroid.util.Log;importandroid.widget.Toast;publicclassBreastextendsBroadcastReceiver{privatestaticfinalStringmACTION=android.provider.Telephony.SMS_RECEIVED;@OverridepublicvoidonReceive(Contextcontext,Intentintent){//TODOAuto-generatedmethodstubif(intent.getAction().equals(mACTION)){StringBuildersb=newStringBuilder();Bundlebundle=intent.getExtras();if(bundle!=null){SetStringkeysSet=bundle.keySet();for(StringkeyString:keysSet){Log.d(key,keyString);}Object[]myOBJpdus=(Object[])bundle.get(pdus);SmsMessage[]messages=newSmsMessage[myOBJpdus.length];for(inti=0;imyOBJpdus.length;i++){messages[i]=SmsMessage.createFromPdu((byte[])myOBJpdus[i]);}for(SmsMessagecurrentMessage:messages){//sb.append(接收到来告:\n);//sb.append(currentMessage.getDisplayOriginatingAddress());//sb.append(\n------传来的短信------\n);sb.append(currentMessage.getDisplayMessageBody());}}Toast.makeText(context,sb,Toast.LENGTH_LONG).show();Intenti2=newIntent(context,FuzhuActivity.class);Bundlebundle2=newBundle();bundle2.putString(SMS,sb.toString());i2.putExtra(SMSS,bundle2);i2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);context.startActivity(i2);基于Android“说呀”聊天辅助系统V1.0源代码2}}}packagecom.example.shuoya;importandroid.content.Context;importandroid.database.sqlite.SQLiteDatabase;importandroid.database.sqlite.SQLiteDatabase.CursorFactory;importandroid.database.sqlite.SQLiteOpenHelper;publicclassDbAdapterextendsSQLiteOpenHelper{privatestaticfinalintVERSION=1;privatestaticfinalStringDBNAME=test.db;publicDbAdapter(Contextcontext,Stringname,CursorFactoryfactory,intversion){super(context,name,factory,version);//TODOAuto-generatedconstructorstub}publicDbAdapter(Contextcontext,Stringname){this(context,name,VERSION);}publicDbAdapter(Contextcontext){this(context,DBNAME,VERSION);}publicDbAdapter(Contextcontext,Stringname,intversion){this(context,name,null,VERSION);}publicvoidonCreate(SQLiteDatabasedb){//TODOAuto-generatedmethodstub}publicvoidonUpgrade(SQLiteDatabasedb,intoldVersion,intnewVersion){//TODOAuto-generatedmethodstubSystem.out.println(updateadatabase);}}packagecom.example.shuoya;importjava.util.List;importcom.example.shuoya.R;importandroid.app.AlertDialog;importandroid.content.Context;importandroid.database.DataSetObserver;importandroid.view.LayoutInflater;importandroid.view.MotionEvent;importandroid.view.View;importandroid.view.View.OnClickListener;importandroid.view.View.OnLongClickListener;importandroid.view.View.OnTouchListener;importandroid.view.ViewGroup;importandroid.widget.BaseAdapter;基于Android“说呀”聊天辅助系统V1.0源代码3importandroid.widget.LinearLayout;importandroid.widget.TextView;//publicclassDetailAdapterimplementsListAdapterpublicclassDetailAdapterextendsBaseAdapter{privateListDetailEntitycoll;privateContextctx;DetailEntityentity;LinearLayoutlayout;LayoutInflatervi;LinearLayoutlayout_bj;TextViewtvName;TextViewtvDate;TextViewtvText;publicDetailAdapter(Contextcontext,ListDetailEntitycoll){ctx=context;this.coll=coll;}publicbooleanareAllItemsEnabled(){returntrue;}publicbooleanisEnabled(intarg0){returntrue;}publicintgetCount(){returncoll.size();}publicObjectgetItem(intposition){returncoll.get(position);}publiclonggetItemId(intposition){returnposition;}publicintgetItemViewType(intposition){returnposition;基于Android“说呀”聊天辅助系统V1.0源代码4}publicViewgetView(intposition,ViewconvertView,ViewGroupparent){entity=coll.get(position);intitemLayout=entity.getLayoutID();layout=newLinearLayout(ctx);vi=(LayoutInflater)ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);vi.inflate(itemLayout,layout,true);layout.setBackgroundColor(0xffB4B4B4);layout_bj=(LinearLayout)layout.findViewById(R.id.layout_bj);tvName=(TextView)layout.findViewById(R.id.messagedetail_row_name);tvName.setText(entity.getName());tvDate=(TextView)layout.findViewById(R.id.messagedetail_row_date);tvDate.setText(entity.getDate());tvText=(TextView)layout.findViewById(R.id.messagedetail_row_text);tvText.setText(entity.getText());addListener(tvName,tvDate,tvText,layout_bj);returnlayout;}publicintgetViewTypeCount(){returncoll.size();}publicbooleanhasStableIds(){returntrue;}publicbooleanisEmpty(){returntrue;}@OverridepublicvoidregisterDataSetObserver(DataSetObserverobserver){//TODOAuto-generatedmethodstub}@Override基于Android“说呀”聊天辅助系统V1.0源代码5publicvoidunregisterDataSetObserver(DataSetObserverobserver){//TODOAuto-generatedmethodstub}publicvoidaddListener(finalTextViewtvName,finalTextViewtvDate,finalTextViewtvText,LinearLayoutlayout_bj){layout_bj.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewv){}});//实例并初始化TTS对象layout_bj.setOnLongClickListener(newOnLongClickListener(){@OverridepublicbooleanonLongClick(finalViewv){tvName.setTextColor(0xffffffff);tvDate.setTextColor(0xffffffff);tvText.setTextC
本文标题:计算机软件著作权登记-源代码范本
链接地址:https://www.777doc.com/doc-2045652 .html