private void setPic() { // Get the dimensions of the View int targetW = mImageView.getWidth(); int targetH = mImageView.getHeight(); // Get the dimensions of the bitmap BitmapFactory.Options bmOptions = new BitmapFactory.Options(); bmOptions.inJustDecodeBounds = true; BitmapFactory.decodeFile(mCurrentPhotoPath, bmOptions); int photoW = bmOptions.outWidth; int photoH = bmOptions.outHeight; // Determine how much to scale down the image int scaleFactor = Math.min(photoW / targetW, photoH / targetH); // Decode the image file into a Bitmap sized to fill the View bmOptions.inJustDecodeBounds = false; bmOptions.inSampleSize = scaleFactor; bmOptions.inPurgeable = true; Bitmap bitmap = BitmapFactory.decodeFile(mCurrentPhotoPath, bmOptions); mImageView.setImageBitmap(bitmap); Intent intent = new Intent(this, CropImageActivity.class); // intent.putExtra("bitmap", bitmap); MyApplication application = (MyApplication) getApplication(); application.mBitmap = bitmap; startActivity(intent); String directoryDcim = Environment.DIRECTORY_DCIM; }
@Override protected void onPause() { super.onPause(); Log.d(TAG, "ArticleActivity OnPause"); MyApplication myApp = (MyApplication) this.getApplication(); myApp.setLastNewsTitle(currentNews.getTitle()); }
private void buildMainLayout() { // setMainWindow(new Window("Address Book Demo application")); MyApplication.debug(3, "buildMainLayout"); // getWindow().setName("FirstPage!"); layout = new VerticalLayout(); layout.setSizeFull(); layout.addComponent(createToolbar()); layout.addComponent(horizontalSplit); /* Allocate all available extra space to the horizontal split panel */ layout.setExpandRatio(horizontalSplit, 1); /* Set the initial split position so we can have a 200 pixel menu to the left */ horizontalSplit.setSplitPosition(200, SplitPanel.UNITS_PIXELS); MyApplication.debug(3, "buildMainLayout 2"); try { if (layout != null) { getWindow().setLayout(layout); MyApplication.debug(3, "buildMainLayout end"); } } catch (Exception e) { e.printStackTrace(); } }
public void clickDecline(View v) { application.current_delivery.state = 4; updateDelivery(); edit.putInt("prevDeliveryID", application.current_delivery.id); edit.commit(); application.current_delivery = null; application.declined_delivery = true; this.finish(); }
/** * 响应事件,处理listView的item的点击事件 * * @param v */ @Override public void onClick(View v) { Object tag = v.getTag(); if (tag != null && tag instanceof String) { String s = (String) tag; String[] split = s.split(":"); Intent intent; // TODO 跳转用户界面Activity int location = Integer.parseInt(split[1]); if (split[0].equals("GenPhoto")) { Toast.makeText( getContext(), "点击了" + list.get(location).getGenNickName(), Toast.LENGTH_SHORT) .show(); } else if (split[0].equals("HabitName")) { // TODO 跳转习惯介绍界面Activity intent = new Intent(getContext(), HabbitInfoActivity.class); intent.putExtra("DetailId", list.get(location).getDetailId()); startActivity(intent); } else if (split[0].equals("PraiseImages")) { // TODO 跳转赞我的人界面Activity Toast.makeText( getContext(), "点击了" + list.get(location).getGenNickName() + "点赞人图标", Toast.LENGTH_SHORT) .show(); } else if (split[0].equals("CommentCount")) { // TODO 跳转评论界面Activity或者登录界面 if (!MyApplication.ISLOADING()) { intent = new Intent(getContext(), EntryActivity.class); startActivity(intent); } else { } } else if (split[0].equals("PraiseCount")) { // TODO 跳转赞界面Activity或者登录界面 if (!MyApplication.ISLOADING()) { intent = new Intent(getContext(), EntryActivity.class); startActivity(intent); } else { } } else if (split[0].equals("CommentListEntity")) { // TODO 跳转评论详情界面Activity或者登录界面 if (!MyApplication.ISLOADING()) { intent = new Intent(getContext(), EntryActivity.class); startActivity(intent); } else { } } else { // TODO 跳转详情界面Activity intent = new Intent(getContext(), TrendsInfoAcitivity.class); intent.putExtra("data", list.get(location)); startActivity(intent); } } }
public static void main(String[] args) throws HL7Exception, JAXBException { String msg = "MSH|^~\\&|1.3.6.1.4.1.12201^1.3.6.1.4.1.12201.101.1|UHN^1.3.6.1.4.1.12201|ConnectingGTA|ConnectingGTA|20130225000100-0500|2954864636aaa|ADT^A11^ADT_A09|142981|T|2.5|||NE|AL|CAN|8859/1|||CGTA_CDR_INPUT_2_0\r" + "EVN||201302250001\r" + "PID|1||7013623^^^1.3.6.1.4.1.12201&1.3.6.1.4.1.12201.101.1^MR~HN3651^^^1.3.6.1.4.1.12201&1.3.6.1.4.1.12201.101.1^PI||Test^Alexfive^^^^^L||19700105|M|||21 jump street^^NORTH YORK^CANON^M3A 1Y8^Can^H||(416)444-4444^PRN^PH^^1^416^4444444||eng^English^HL70296|||||||||||||||N\r" + "PV1|1|I|^^^1.3.6.1.4.1.12201&1.3.6.1.4.1.12201.100.1|R||^^^1.3.6.1.4.1.12201&1.3.6.1.4.1.12201.100.1||1185^Abrams^Howard^^^Dr.^MD^^1.3.6.1.4.1.12201.1.2.1.5&1.3.6.1.4.1.12201&1.3.6.1.4.1.12201.101.1||General Internal Medicine||||||N|13546^Generic^Physician^Moe^^Dr.^MD^^1.3.6.1.4.1.12201.1.2.1.5&1.3.6.1.4.1.12201&1.3.6.1.4.1.12201.101.1||11210000302^^^1.3.6.1.4.1.12201&1.3.6.1.4.1.12201.101.1^VN|||||||||||||||||||||||||20120628105900-0400\r" + "PV2|||^test"; Message parsed = PipeParser.getInstanceWithNoValidation().parse(msg); CgtaHohServlet s = new CgtaHohServlet(); MyApplication application = s.new MyApplication(); application.processMessage(parsed, new HashMap<String, Object>()); }
public void onClick(View v) { MyApplication myApp = ((MyApplication) getApplication()); String name = acctName.getText().toString(); PaymentMethod newMethod = new PaymentMethod(); newMethod.setName(name); newMethod.setInfo(""); myApp.addAccount(newMethod); Toast.makeText( getApplicationContext(), myApp.paymentNames().get(myApp.accountsSize() - 1) + "has been added", Toast.LENGTH_LONG) .show(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTextView = (TextView) findViewById(R.id.testtext); List<NameValuePair> parameters = new ArrayList<NameValuePair>(); MyApplication myApplication = (MyApplication) getApplicationContext(); JSONObject json = mController.show(myApplication.getPhnum(), myApplication.getPass()); try { String mstring = "电话号码:" + json.getString("phone") + "\n" + "工作:" + json.getString("job") + "\n" + "姓名:" + json.getString("name") + "\n" + "房产:" + json.getString("house") + "\n" + "汽车:" + json.getString("car") + "\n" + "身份证:" + json.getString("id_card") + "\n" + "月收入:" + json.getString("salary") + "\n" + "贷款城市:" + json.getString("city") + "\n" + "贷款金额:" + json.getString("creadit") + "\n" + "贷款时间:" + json.getString("time") + "\n"; mTextView.setText(mstring); Log.e("mstring", mstring); } catch (JSONException e) { e.printStackTrace(); } }
private static String dateToShow(String date, int i) { if (i == 0) { return MyApplication.getContext().getResources().getString(R.string.today); } else if (i == 1) { return MyApplication.getContext().getResources().getString(R.string.tomorrow); } Pattern pattern = Pattern.compile("\\d\\d\\d\\d-(\\d\\d-\\d\\d)"); Matcher matcher = pattern.matcher(date); if (matcher.find()) { // Log.d("MyLog", matcher.group(1)); return matcher.group(1); } else { throw new RuntimeException(date + " is not a valid date value. Should be yyyy-mm-dd"); } }
public void drawCircleOnDyn(Point2D point2D, float azimuth, double q) { if (point2D.getX() == 0 || point2D.getY() == 0) { MyApplication.getInstance().showInfo("定位点为空"); return; } m_locateDynamicView.removeElement(m_LocationID); m_locateDynamicView.removeElement(m_LocationPolygonID); // 构造精度范围 if (q == 0) { q = 60; } GeoCircle geoCircle = new GeoCircle(point2D, q); GeoRegion geoRegion = geoCircle.convertToRegion(50 * 4); // 绘制精度范围 DynamicPolygon dynPolygon = new DynamicPolygon(); dynPolygon.fromGeometry(geoRegion); DynamicStyle style = new DynamicStyle(); style.setBackColor(android.graphics.Color.rgb(128, 128, 255)); style.setLineColor(android.graphics.Color.rgb(128, 255, 255)); // 224, 224, 224 style.setAlpha(65); // 95 // style.setSize(3.0f);//6.0f dynPolygon.setStyle(style); m_locateDynamicView.addElement(dynPolygon); m_LocationPolygonID = dynPolygon.getID(); drawPoint(point2D, azimuth); }
// 夜间模式 @Override protected void onStart() { // TODO Auto-generated method stub super.onStart(); mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); Myapp = (MyApplication) getApplication(); if (nightView != null) { mWindowManager.removeView(nightView); nightView = null; } if (Myapp.getlunaMode()) { WindowManager.LayoutParams params = new WindowManager.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, android.view.WindowManager.LayoutParams.TYPE_APPLICATION, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT); params.gravity = Gravity.BOTTOM; if (nightView == null) { nightView = new TextView(this); nightView.setBackgroundColor(0xa0000000); mWindowManager.addView(nightView, params); } } else { if (nightView != null) { mWindowManager.removeView(nightView); } } }
@Override public View onCreateView( LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v = inflater.inflate(R.layout.frag_tab_trend, container, false); listView = (ListView) v.findViewById(R.id.tab_trend_list); trendDataSource = new TrendDataSource(getActivity().getApplicationContext()); Date today = MyApplication.getTodayDate(); String order = DbTrend.COLUMN_COUNT + " DESC"; String limit = "50"; trendDataSource.open(); trendList = trendDataSource.getTrendsByDate(limit, order, today.getTime()); trendDataSource.close(); adapter = new FragTabTrendsAdapter( getActivity().getApplicationContext(), inflater, R.layout.frag_tab_trend_item_row, trendList); listView.setEmptyView(v.findViewById(R.id.emptyElement)); listView.setAdapter(adapter); return v; }
public class AndroidBug5497Workaround { // For more information, see https://code.google.com/p/android/issues/detail?id=5497 // To use this class, simply invoke assistActivity() on an Activity that already has its content // view set. public static void assistActivity(Activity activity) { new AndroidBug5497Workaround(activity); } private View mChildOfContent; private int usableHeightPrevious; private FrameLayout.LayoutParams frameLayoutParams; // get application context from MainActivity & get shared preferences private static Context context = MyApplication.getContextOfApplication(); final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); private AndroidBug5497Workaround(Activity activity) { FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent .getViewTreeObserver() .addOnGlobalLayoutListener( new ViewTreeObserver.OnGlobalLayoutListener() { public void onGlobalLayout() { possiblyResizeChildOfContent(); } }); frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams(); } private void possiblyResizeChildOfContent() { int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { int usableHeightSansKeyboard = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboard - usableHeightNow; if (heightDifference > (usableHeightSansKeyboard / 4)) { // keyboard probably just became visible frameLayoutParams.height = usableHeightSansKeyboard - heightDifference; } else { // keyboard probably just became hidden frameLayoutParams.height = usableHeightSansKeyboard; } mChildOfContent.requestLayout(); usableHeightPrevious = usableHeightNow; } } private int computeUsableHeight() { Rect r = new Rect(); mChildOfContent.getWindowVisibleDisplayFrame(r); // if transparent navigation enabled avoid too large bottom padding if (preferences.getBoolean("transparent_nav", false)) return (r.bottom - r.top + 144); // additional 48 added for better text editing return (r.bottom - r.top + 48); } }
private void initUI() { mi = new MenuInflater(this); layout_body_activity = (LinearLayout) findViewById(R.id.bodylayout); img_recent_chat = (ImageView) findViewById(R.id.tab1); img_recent_chat.setOnClickListener(this); img_friend_list = (ImageView) findViewById(R.id.tab2); img_friend_list.setOnClickListener(this); img_group_friend = (ImageView) findViewById(R.id.tab3); img_group_friend.setOnClickListener(this); myHeadImage = (ImageView) findViewById(R.id.friend_list_myImg); myName = (TextView) findViewById(R.id.friend_list_myName); cursor = (ImageView) findViewById(R.id.tab2_bg); // myHeadImage.setImageResource(imgs[list.get(0).getImg()]); myName.setText(list.get(0).getUserName()); layout_body_activity.setFocusable(true); mPager = (ViewPager) findViewById(R.id.viewPager); mListViews = new ArrayList<View>(); LayoutInflater inflater = LayoutInflater.from(this); View lay1 = inflater.inflate(R.layout.tab11, null); View lay2 = inflater.inflate(R.layout.tab22, null); View lay3 = inflater.inflate(R.layout.tab33, null); mListViews.add(lay1); mListViews.add(lay2); mListViews.add(lay3); mPager.setAdapter(new MyPagerAdapter(mListViews)); mPager.setCurrentItem(PAGE2); mPager.setOnPageChangeListener(new MyOnPageChangeListener()); // 下面是最近会话界面处理 mRecentListView = (ListView) lay1.findViewById(R.id.tab1_listView); // mRecentAdapter = new RecentChatAdapter(FriendListActivity.this, // application.getmRecentList());// 从全局变量中获取最近聊天对象数组 mRecentListView.setAdapter(application.getmRecentAdapter()); // 先设置空对象,要么从数据库中读出 // 下面是处理好友列表界面处理 // myListView = (MyListView) lay2.findViewById(R.id.tab2_listView); myExAdapter = new MyExAdapter(this, group); myListView.setAdapter(myExAdapter); myListView.setGroupIndicator(null); // 不设置大组指示器图标,因为我们自定义设置了 myListView.setDivider(null); // 设置图片可拉伸的 myListView.setFocusable(true); // 聚焦才可以下拉刷新 // 2015 myListView.setonRefreshListener(new MyRefreshListener()); // 下面是群组界面处理 mGroupListView = (ListView) lay3.findViewById(R.id.tab3_listView); List<GroupEntity> groupList = new ArrayList<GroupEntity>(); GroupEntity entity = new GroupEntity(0, "C175地带", "怀念高中生活..."); GroupEntity entity2 = new GroupEntity(0, "Android开发", "爱生活...爱Android..."); groupList.add(entity); groupList.add(entity2); GroupAdapter adapter = new GroupAdapter(this, groupList); mGroupListView.setAdapter(adapter); }
private void buildReferenceList() { try { String[] locations = (new File(MyApplication.getExtStoragePath() + "/reference_data")).list(); references = new ArrayList<LocationPoint>(); for (String loc : locations) { String[] files = (new File(MyApplication.getExtStoragePath() + "/reference_data/" + loc)).list(); if (files.length != 0) references.add(new LocationPoint(loc)); } } catch (IOException e) { e.printStackTrace(); } }
@Override protected void onResume() { // 如果从后台恢复,服务被系统干掉,就重启一下服务 // TODO Auto-generated method stub newNum = application.getRecentNum(); // 从新获取一下全局变量 if (!application.isClientStart()) { Intent service = new Intent(this, GetMsgService.class); startService(service); } new SharePreferenceUtil(this, Constants.SAVE_USER).setIsStart(false); NotificationManager manager = application.getmNotificationManager(); if (manager != null) { manager.cancel(Constants.NOTIFY_ID); application.setNewMsgNum(0); // 把消息数目置0 application.getmRecentAdapter().notifyDataSetChanged(); } super.onResume(); }
public RequestQueue getRequestQueue() { if (requestQueue == null) { Cache cache = new DiskBasedCache(MyApplication.getAppContext().getCacheDir(), 10 * 1024 * 1024); Network network = new BasicNetwork(new HurlStack()); requestQueue = new RequestQueue(cache, network); } return requestQueue; }
public static int[] getSavedBounds() { int[] bound = new int[10]; SharedPreferences preferences = MyApplication.getInstance().getSharedPreferences("bounds", Activity.MODE_PRIVATE); for (int i = 0; i < 10; i++) { bound[i] = preferences.getInt("equal" + String.valueOf(i), 50); } return bound; }
private String fileToJSONString(String fileName) throws IOException { String extStoragePath = MyApplication.getContext().getExternalFilesDir(null).getAbsolutePath(); // AssetManager assetManager = MyApplication.getContext().getAssets(); InputStream inputStream = new FileInputStream(extStoragePath + "/measurement_data/" + fileName); // InputStream inputStream = assetManager.open("measurement_data/" + fileName); String jsonString = new Scanner(inputStream).useDelimiter("\\A").next(); inputStream.close(); return jsonString; }
public void sendPlot() { Layer layerCAD = mMapControl.getMap().getLayers().get(0); Recordset record = ((DatasetVector) layerCAD.getDataset()).getRecordset(false, CursorType.DYNAMIC); record.moveFirst(); int failedCount = 0; // 记录发送失败的数据个数 while (!record.isEOF()) { String msg = "{content_type=2}"; String plotID = record.getFieldValue("PlotID").toString(); if (m_ArraySendedIDs.contains(plotID)) { record.moveNext(); continue; } msg += "{PlotID="; msg += plotID; msg += "}"; // 对象类型 GeometryType type = record.getGeometry().getType(); msg += "{type="; msg += type.value(); // type.toString(); msg += "}"; String geoJson = record.getGeometry().toXML(); msg += geoJson; boolean bOk = m_MessageQueue.sendMessageByType(msg, 2); if (bOk) { m_ArraySendedIDs.add(plotID); MyApplication.getInstance().showInfo("发送成功"); } else { failedCount++; } record.moveNext(); } record.dispose(); if (failedCount != 0) { MyApplication.getInstance().showInfo("发送失败" + failedCount + "个对象,请继续发送!"); } }
private void loadSymbolLibrary() { File fLibJB = new File(mLibJBPath); File fLibTY = new File(mLibTYPath); if (fLibJB.exists() && fLibTY.exists()) { mLIBIDJB = mMapControl.addPlotLibrary(mLibJBPath); mLIBIDTY = mMapControl.addPlotLibrary(mLibTYPath); } else { MyApplication.getInstance().showError("符号库文件不存在。。。"); } }
public HorizontalLayout createToolbar() { MyApplication.debug(3, "createToolbar"); HorizontalLayout lo = new HorizontalLayout(); lo.addComponent(newContact); lo.addComponent(search); lo.addComponent(share); lo.addComponent(help); return lo; }
// 该构造方法获得需要的参数,传入需要post的信息 public NormalPostRequest( String url, Listener<JSONObject> listener, ErrorListener errorListener, Map<String, String> map, Context context) { super(Request.Method.POST, url, errorListener); mListener = listener; mMap = map; cookie = MyApplication.getLocalSharedPreferences().getString("cookie", null); type = mMap.get("type"); }
@Override public void onBindViewHolder(DailyForecastViewHolder viewHolder, int i) { Weather.DailyForecast dailyForecast = dailyForecasts.get(i); viewHolder.dateText.setText(dateToShow(dailyForecast.date, i)); viewHolder.tempText.setText(dailyForecast.minTemp + "° ~ " + dailyForecast.maxTemp + "°"); int drawableId = MyApplication.getContext() .getResources() .getIdentifier( "w" + dailyForecast.code_d, "drawable", MyApplication.getContext().getPackageName()); viewHolder.condImage_d.setImageResource(drawableId); drawableId = MyApplication.getContext() .getResources() .getIdentifier( "w" + dailyForecast.code_n, "drawable", MyApplication.getContext().getPackageName()); viewHolder.condImage_n.setImageResource(drawableId); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_my_send_memo); MyApplication.addActivity(this); mHttpHandler = new HttpHandler(this); init(); APPConfigure.setAPPBackGroup( (LinearLayout) findViewById(R.id.MySendMemoActivityID), null, APPConfigure.APPBgImgUrl, APPConfigure.APPBgImgID); }
private void SetAlarmByDate(Calendar settingCal, String type) { // 時間をセット Calendar calendar = settingCal; // 秒は0にしとく calendar.set(Calendar.SECOND, 0); // context appContext = MyApplication.getAppContext(); Intent intent = new Intent(appContext, AlarmBroadcastReceiver.class); // intentにidを渡す intent.putExtra("intentId", GetIntentId()); intent.putExtra("alarmType", type); PendingIntent pending = PendingIntent.getBroadcast(appContext, GetIntentId(), intent, 0); // アラームをセットする AlarmManager am = (AlarmManager) appContext.getSystemService(appContext.ALARM_SERVICE); am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pending); LogUtil.LogString("set alarm" + CalendarUtil.GetCalendarInfo(calendar)); Toast.makeText(MyApplication.getAppContext(), "SetAlarm", Toast.LENGTH_LONG).show(); if (type == "YABA") { yabaCalendarDate = settingCal; } }
@Override public void getMessage(TranObject msg) { // 重写父类的方法,处理消息 // TODO Auto-generated method stub switch (msg.getType()) { case MESSAGE: newNum++; application.setRecentNum(newNum); // 保存到全局变量 TextMessage tm = (TextMessage) msg.getObject(); String message = tm.getMessage(); // ChatMsgEntity entity = new ChatMsgEntity("", MyDate.getDateEN(), // message, -1, true);// 收到的消息 // messageDB.saveMsg(msg.getFromUser(), entity);// 保存到数据库 Toast.makeText(FriendListActivity.this, "亲!新消息哦 " + msg.getFromUser() + ":" + message, 0) .show(); // 提示用户 MediaPlayer.create(this, R.raw.msg).start(); // 声音提示 User user2 = userDB.selectInfo(msg.getFromUser()); // 通过id查询对应数据库该好友信息 // RecentChatEntity entity2 = new RecentChatEntity(msg.getFromUser(), // user2.getImg(), newNum, user2.getUserName(), MyDate.getDate(), // message); // application.getmRecentAdapter().remove(entity2);// 先移除该对象,目的是添加到首部 // application.getmRecentList().addFirst(entity2);// 再添加到首部 application.getmRecentAdapter().notifyDataSetChanged(); break; case LOGIN: User loginUser = (User) msg.getObject(); Toast.makeText(FriendListActivity.this, "亲!" + loginUser.getId() + "上线了哦", 0).show(); MediaPlayer.create(this, R.raw.msg).start(); break; case LOGOUT: User logoutUser = (User) msg.getObject(); Toast.makeText(FriendListActivity.this, "亲!" + logoutUser.getId() + "下线了哦", 0).show(); MediaPlayer.create(this, R.raw.msg).start(); break; default: break; } }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if ((System.currentTimeMillis() - mExitTime) > 2000) { Snackbar.make(tabs, getResources().getString(R.string.app_exit), Snackbar.LENGTH_LONG) .show(); mExitTime = System.currentTimeMillis(); } else { finish(); MyApplication.getInstance().exit(); } return true; } return super.onKeyDown(keyCode, event); }
@Override protected void onHandleIntent(Intent intent) { String action = intent.getAction(); String taskID = intent.getExtras().getString("data", ""); Integer notificationId = Common.isNull(intent.getExtras().getInt("notificationId"), 0); NotificationManager mNotifyMgr = (NotificationManager) MyApplication.getCurrentActivity().getSystemService(NOTIFICATION_SERVICE); // This section handles the 3 possible actions: // ping, snooze, and dismiss. if (!taskID.equals("")) { if (action.equals(Common.ACTION_NEW)) { MyApplication.getDataProvider().setTaskCreated(taskID); if (notificationId > 0) mNotifyMgr.cancel(notificationId); } else if (action.equals(Common.ACTION_TAKED)) { MyApplication.getDataProvider().setTaskTaked(taskID); if (notificationId > 0) mNotifyMgr.cancel(notificationId); } else if (action.equals(Common.ACTION_COMPLETED)) { MyApplication.getDataProvider().setTaskCompleted(taskID); if (notificationId > 0) mNotifyMgr.cancel(notificationId); } } }
@Override public void handleMessage(Message msg) { // TODO Auto-generated method stub switch (msg.what) { case 1: String groupId = "0"; if (MyApplication.getMyApplication().getLoginUser() != null) { groupId = MyApplication.getMyApplication().getLoginUser().getGroup_id(); } dataList = new ArticleDetailDao().getAllArticleDetailByCategoryAndGroupId("chaxiang", groupId); DatabaseManager.getInstance().closeDatabase(); teaVideoGV.setAdapter(new TeaGridViewAdapter()); if (dataList.size() == 0) { myHandle.sendEmptyMessageDelayed(1, 200); } break; default: break; } }