public void receive() throws Exception {
Log.e(tag, "receive()");
// sharedpreference读取数据,用split()方法,分开字符串。
SharedPreferences pre = getSharedPreferences("SAVE_INFORMATION",MODE_WORLD_READABLE);
String content = "name;pass";//pre.getString("save", "");
String[] Information = content.split(";");
String username = Information[0];
String password = Information[1];
Properties props = new Properties();
Session session = Session.getDefaultInstance(props);
// 取得pop3协议的邮件服务器
Store store = session.getStore("pop3");
// 连接pop.qq.com邮件服务器
store.connect("pop.163.com", username, password);
// 返回文件夹对象
Folder folder = store.getFolder("INBOX");
// 设置仅读
folder.open(Folder.READ_ONLY);
// 获取信息
Message message[] = folder.getMessages();
for(int j=0; j<message.length; j++) {
Log.e(tag, "message[i].getSubject()="+message[j].getSubject());
Log.e(tag, "message[i].getContent()="+message[j].getContent());
}
folder.close(true);
store.close();
}
package com.example.testviewpagerandtabhost; import java.util.ArrayList; import java.util.List; import android.os.Bundle; import android.os.Parcelable; import android.app.Activity; import android.app.LocalActivityManager; import android.content.Context; import android.content.Intent; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.util.DisplayMetrics; import android.view.Menu; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.TranslateAnimation; import android.widget.ImageView; import android.widget.TabHost; import android.widget.TextView; public class MainActivity extends Activity { Context context = null; LocalActivityManager manager = null; ViewPager pager = null; TextView t1,t2,t3; private int offset = 0;// 动画图片偏移量 private int currIndex = 0;// 当前页卡编号 private int bmpW;// 动画图片宽度 private ImageView cursor;// 动画图片 @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); context = MainActivity.this; manager = new LocalActivityManager(this , true); manager.dispatchCreate(savedInstanceState); InitImageView(); initTextView(); initPagerViewer(); } /** * 初始化标题 */ private void initTextView() { t1 = (TextView) findViewById(R.id.text1); t2 = (TextView) findViewById(R.id.text2); t3 = (TextView) findViewById(R.id.text3); t1.setOnClickListener(new MyOnClickListener(0)); t2.setOnClickListener(new MyOnClickListener(1)); t3.setOnClickListener(new MyOnClickListener(2)); } /** * 初始化PageViewer */ private void initPagerViewer() { pager = (ViewPager) findViewById(R.id.viewpage); final ArrayList<View> list = new ArrayList<View>(); Intent intent = new Intent(context, A.class); list.add(getView("A", intent)); Intent intent2 = new Intent(context, B.class); list.add(getView("B", intent2)); Intent intent3 = new Intent(context, C.class); list.add(getView("C", intent3)); pager.setAdapter(new MyPagerAdapter(list)); pager.setCurrentItem(0); pager.setOnPageChangeListener(new MyOnPageChangeListener()); } /** * 初始化动画 */ private void InitImageView() { cursor = (ImageView) findViewById(R.id.cursor); bmpW = BitmapFactory.decodeResource(getResources(), R.drawable.roller) .getWidth();// 获取图片宽度 DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int screenW = dm.widthPixels;// 获取分辨率宽度 offset = (screenW / 3 - bmpW) / 2;// 计算偏移量 Matrix matrix = new Matrix(); matrix.postTranslate(offset, 0); cursor.setImageMatrix(matrix);// 设置动画初始位置 } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } /** * 通过activity获取视图 * @param id * @param intent * @return */ private View getView(String id, Intent intent) { return manager.startActivity(id, intent).getDecorView(); } /** * Pager适配器 */ public class MyPagerAdapter extends PagerAdapter{ List<View> list = new ArrayList<View>(); public MyPagerAdapter(ArrayList<View> list) { this.list = list; } @Override public void destroyItem(ViewGroup container, int position, Object object) { ViewPager pViewPager = ((ViewPager) container); pViewPager.removeView(list.get(position)); } @Override public boolean isViewFromObject(View arg0, Object arg1) { return arg0 == arg1; } @Override public int getCount() { return list.size(); } @Override public Object instantiateItem(View arg0, int arg1) { ViewPager pViewPager = ((ViewPager) arg0); pViewPager.addView(list.get(arg1)); return list.get(arg1); } @Override public void restoreState(Parcelable arg0, ClassLoader arg1) { } @Override public Parcelable saveState() { return null; } @Override public void startUpdate(View arg0) { } } /** * 页卡切换监听 */ public class MyOnPageChangeListener implements OnPageChangeListener { int one = offset * 2 + bmpW;// 页卡1 -> 页卡2 偏移量 int two = one * 2;// 页卡1 -> 页卡3 偏移量 //计算动态图片的位置并设置 @Override public void onPageSelected(int arg0) { Animation animation = null; switch (arg0) { case 0: if (currIndex == 1) { animation = new TranslateAnimation(one, 0, 0, 0); } else if (currIndex == 2) { animation = new TranslateAnimation(two, 0, 0, 0); } break; case 1: if (currIndex == 0) { animation = new TranslateAnimation(offset, one, 0, 0); } else if (currIndex == 2) { animation = new TranslateAnimation(two, one, 0, 0); } break; case 2: if (currIndex == 0) { animation = new TranslateAnimation(offset, two, 0, 0); } else if (currIndex == 1) { animation = new TranslateAnimation(one, two, 0, 0); } break; } currIndex = arg0; animation.setFillAfter(true);// True:图片停在动画结束位置 animation.setDuration(300); cursor.startAnimation(animation); } @Override public void onPageScrollStateChanged(int arg0) { //状态有三个0空闲,1是增在滑行中,2目标加载完毕 //public static final int SCROLL_STATE_IDLE = 0; //public static final int SCROLL_STATE_DRAGGING = 1; //public static final int SCROLL_STATE_SETTLING = 2; } //从页面1滚动到2的过程 @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } } /** * 头标点击监听 */ public class MyOnClickListener implements View.OnClickListener { private int index = 0; public MyOnClickListener(int i) { index = i; } @Override public void onClick(View v) { pager.setCurrentItem(index); } }; }
首先打开你的Safari,进入你要下载视频的网站,选取你要下载的视频点开播放,然后就再点击键盘的option+command+A然后就会出现图1的对话框图2是我要下载的视频地址,这个时候就可以见到对话框里有
一个地址后面显示文件大小的地方会有下载的动作出现,放心很容易就可以找到,因为只有你点开播放的视频地址会动。你直接点击两下就可以下载了。慢慢享受吧,什么网站的视频都可以
哦,只要你的Safari可以打开就可以下载了。
在补充一句:下载的格式是FLV的。