自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

分享一個(gè)非常好的新聞客戶端(基于百度數(shù)據(jù))

移動(dòng)開(kāi)發(fā)
基于百度數(shù)據(jù),一個(gè)非常好用的新聞客戶端。

源碼簡(jiǎn)介:基于百度數(shù)據(jù),一個(gè)非常好用的新聞客戶端。

源碼效果:

源碼片段:

  1. package com.linpeng.baidunewssearch; 
  2.   
  3. import java.lang.reflect.Method; 
  4.   
  5. import com.linpeng.baidunewssearch.R; 
  6. import com.linpeng.fragment.FragmentNews; 
  7. import com.linpeng.fragment.FragmentPhoto; 
  8. import com.linpeng.fragment.FragmentPostbar; 
  9. import com.linpeng.fragment.FragmentQuestion; 
  10.   
  11. import android.view.Menu; 
  12. import android.view.MenuItem; 
  13. import android.view.View; 
  14. import android.view.Window; 
  15. import android.app.Activity; 
  16. import android.app.Fragment; 
  17. import android.content.Intent; 
  18. import android.os.Bundle; 
  19.    
  20.   
  21. public class MainActivity extends Activity { 
  22.   
  23.     private Fragment[] fragments = new Fragment[4]; 
  24.   
  25.     @Override 
  26.     protected void onCreate(Bundle savedInstanceState) { 
  27.         super.onCreate(savedInstanceState); 
  28.         setContentView(R.layout.activity_main); 
  29.    
  30.         fragments[0] = new FragmentNews(); 
  31.         fragments[1] = new FragmentPostbar(); 
  32.         fragments[2] = new FragmentQuestion(); 
  33.         fragments[3] = new FragmentPhoto(); 
  34.         getFragmentManager().beginTransaction().add(R.id.main_fragment,fragments[1]) 
  35.         .add(R.id.main_fragment,fragments[2]).add(R.id.main_fragment,fragments[3]).add(R.id.main_fragment,fragments[0]).commit(); 
  36.         newsClick(null); 
  37.     } 
  38.   
  39.     public void newsClick(View view){ 
  40.         getFragmentManager().beginTransaction().hide(fragments[1])  
  41.         .hide(fragments[2]).hide(fragments[3]).show(fragments[0]).commit(); 
  42.       
  43.         getActionBar().setTitle("新聞"); 
  44.     } 
  45.       
  46.     public void postbarClick(View view){ 
  47.         getFragmentManager().beginTransaction().hide(fragments[0]) 
  48.         .hide(fragments[2]).hide(fragments[3]).show(fragments[1]).commit(); 
  49.           
  50.         getActionBar().setTitle("貼吧"); 
  51.     } 
  52.       
  53.     public void questionClick(View view){ 
  54.         getFragmentManager().beginTransaction().hide(fragments[0]) 
  55.         .hide(fragments[1]).hide(fragments[3]).show(fragments[2]).commit(); 
  56.         getActionBar().setTitle("知道"); 
  57.     } 
  58.       
  59.     public void photoClick(View view){ 
  60.         getFragmentManager().beginTransaction().hide(fragments[0]) 
  61.         .hide(fragments[1]).hide(fragments[2]).show(fragments[3]).commit(); 
  62.         getActionBar().setTitle("圖片"); 
  63.     } 
  64.       
  65.     @Override 
  66.     public boolean onCreateOptionsMenu(Menu menu) { 
  67.         getMenuInflater().inflate(R.menu.menu, menu);  
  68.         return true
  69.     } 
  70.     @Override 
  71.     public boolean onMenuItemSelected(int featureId, MenuItem item) { 
  72.         switch (item.getItemId()) { 
  73.         case R.id.menu_share: 
  74.             Intent intent = new Intent(Intent.ACTION_SEND); 
  75.             intent.setType("text/plain");  
  76.             intent.putExtra(Intent.EXTRA_TEXT, "這是一個(gè)可以定制關(guān)鍵詞的新聞app,歡迎體驗(yàn)");  
  77.             startActivity(Intent.createChooser(intent, getTitle())); 
  78.             break
  79.   
  80.         default
  81.             break
  82.         } 
  83.         return super.onMenuItemSelected(featureId, item); 
  84.     } 
  85.   
  86.     @Override 
  87.     public boolean onMenuOpened(int featureId, Menu menu) { 
  88.         if (featureId == Window.FEATURE_ACTION_BAR && menu != null) {   
  89.             if (menu.getClass().getSimpleName().equals("MenuBuilder")) {   
  90.                 try {   
  91.                     Method m = menu.getClass().getDeclaredMethod("setOptionalIconsVisible", Boolean.TYPE);   
  92.                     m.setAccessible(true);   
  93.                     m.invoke(menu, true);   
  94.                 } catch (Exception e) {   
  95.                     e.printStackTrace(); 
  96.                 }   
  97.             }   
  98.         }   
  99.         return super.onMenuOpened(featureId, menu); 
  100.     } 
  101.   

下載地址http://down.51cto.com/data/2089511

責(zé)任編輯:倪明 來(lái)源: devstore
相關(guān)推薦

2011-10-28 16:19:21

百度搜索

2011-11-28 10:02:12

百度知道微問(wèn)答移動(dòng)

2017-09-12 17:05:02

AndroidLoading客戶端

2013-05-16 11:12:29

百度百度MTC錄制回放客戶端

2021-12-16 10:08:47

鴻蒙HarmonyOS應(yīng)用

2021-09-03 14:15:30

百度開(kāi)源可視化

2014-07-25 17:12:39

數(shù)據(jù)庫(kù)WOT2014MongoDB

2022-03-14 09:35:43

Pythonhttpx

2013-09-18 10:07:24

2021-01-04 20:48:19

TypeScriptJS前端

2009-04-30 10:03:33

百度俞軍離職

2019-04-28 11:01:05

云安全云計(jì)算CASB

2015-10-27 09:14:36

數(shù)據(jù)監(jiān)控運(yùn)維百度

2014-11-03 10:00:46

Memblaze閃存

2009-11-09 09:09:42

Windows 7市場(chǎng)銷售

2011-06-10 15:18:41

百度收錄

2021-03-04 09:20:20

數(shù)據(jù)Redis 架構(gòu)

2013-10-08 10:22:14

2021-03-15 09:27:05

Redis優(yōu)化技術(shù)

2019-07-22 20:03:23

Docker操作系統(tǒng)Linux
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)