ppgl1988 发表于 2013-2-3 11:05:04

Android打开TXT文件

super.onCreate(savedInstanceState);      setContentView(R.layout.main);      Button button = (Button) this.findViewById(R.id.button);      button.setOnClickListener(new View.OnClickListener() {            @Override            public void onClick(View v) {                Intent intent = new Intent(Intent.ACTION_VIEW);                intent.addCategory(Intent.CATEGORY_DEFAULT);                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri uri = Uri.fromFile(new File("/data/data/com.example/files/test.txt"));                intent.setDataAndType(uri,   "text/plain");                startActivity(intent);            }      });
页: [1]
查看完整版本: Android打开TXT文件