【问题标题】:Android - Black blank screen on switching to new activity (chmod failed)Android - 切换到新活动时出现黑屏(chmod 失败)
【发布时间】:2015-02-25 19:24:50
【问题描述】:

我正在使用 eclipse,当我运行我的应用程序时,第一个活动工作正常,但是一旦我单击一个按钮开始另一个活动,我在模拟器上就会看到一个空白的黑屏。以下是日志猫:

P.S - 第二个活动从内部存储器访问数据库文件。

有人可以帮忙吗?

日志猫:-

02-24 10:50:05.942:W/FileUtils(9321):chmod 失败(/data/data/com.example.quiz/databases/CQuiz):libcore.io.ErrnoException:chmod 失败: EPERM(不允许操作)
.
02-24 10:50:06.462: D/dalvikvm(9321): GC_FOR_ALLOC 释放 359K,13% 释放 3053K/3476K,暂停 74ms,总共 108ms
02-24 10:50:07.592: D/dalvikvm(9321): GC_FOR_ALLOC 释放 64K,4% 释放 3501K/3632K,暂停 83ms,总共 84ms

第二次活动 -

public class Andro extends ActionBarActivity
  TextView tv;
  RadioButton r1,r2,r3,r4;
  RadioGroup rg;
  Button pre,nex,conf;
MyDatabase md;
Cursor c;
String ans;
protected void onCreate(Bundle b){

super.onCreate(b);
setContentView(R.layout.a_quiz);

tv= (TextView)findViewById(R.id.textView1);
r1 = (RadioButton)findViewById(R.id.RadioButton01);
r2 = (RadioButton)findViewById(R.id.radio0);
r3 = (RadioButton)findViewById(R.id.radio1);
r4 = (RadioButton)findViewById(R.id.radio2);
rg = (RadioGroup)findViewById(R.id.radioGroup1);

pre = (Button)findViewById(R.id.button1);
nex = (Button)findViewById(R.id.button2);
conf = (Button)findViewById(R.id.button3);

md= new MyDatabase(getApplicationContext(),"CQuiz",null,1);

c = md.fetch();
c.moveToFirst();
Integer count=c.getColumnCount();
Toast.makeText(this,count.toString()+"columns",3000).show();
while(c.isFirst())
{ 
  tv.setText(c.getString(0));
   r1.setText(c.getString(1));
   r2.setText(c.getString(2));
  r3.setText(c.getString(3));
   r4.setText(c.getString(4));
   }     
     }
    }

另外,如果首选外部存储器来存储数据库,如何在java代码中访问数据库文件。就像从内部存储器访问一样,使用构造函数的参数,其中“CQuiz”是我项目的数据库文件夹中的数据库文件。

【问题讨论】:

    标签: java android sqlite chmod


    【解决方案1】:

    为此,您需要将手机植根。 http://en.wikipedia.org/wiki/Rooting_%28Android_OS%29

    【讨论】:

    • 我正在尝试在 Eclipse IDE 中构建应用程序:/:|
    猜你喜欢
    • 2015-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-23
    • 1970-01-01
    相关资源
    最近更新 更多