mercredi 25 février 2015

Android - Black blank screen on switching to new activity (chmod failed)

I am using eclipse and when i run my app , first activity works fine , but as soon as i click a button to start another activity , a blank black screen is all i get on emulator. Following is the logcat :


P.S - second activity accesses database file from internal memory .


Can anybody Help ?


logcat : -


02-24 10:50:05.942: W/FileUtils(9321): Failed to chmod(/data/data/http://ift.tt/17uD4AT): libcore.io.ErrnoException: chmod failed: EPERM (Operation not permitted)

.

02-24 10:50:06.462: D/dalvikvm(9321): GC_FOR_ALLOC freed 359K, 13% free 3053K/3476K, paused 74ms, total 108ms

02-24 10:50:07.592: D/dalvikvm(9321): GC_FOR_ALLOC freed 64K, 4% free 3501K/3632K, paused 83ms, total 84ms


2nd activity -



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));
}
}
}


Also , if external memory is preferred for storing database , how to access database file in the java code .Like to access from internal memory, constructor's parameter is used where "CQuiz" is the database file in databases folder of my project.


Aucun commentaire:

Enregistrer un commentaire