Hello everyone i've been following this tutorial: http://coenraets.org/blog/android-samples/androidtutorial/ . I got what i needed from it , but now i have reached a problem. Basically , what i need is to be able to add a picture for each employee. I want a thumbnail picture on the list created and a full sized photo on the details page. How can i do this?
I tried to add a Photo marker in the database
String sql = "CREATE TABLE IF NOT EXISTS employee (" +
"_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
"firstName TEXT, " +
"lastName TEXT, " +
"title TEXT, " +
"officePhone TEXT, " +
"cellPhone TEXT, " +
"email TEXT, " +
photo IMAGE," + "managerId INTEGER)";
db.execSQL(sql);
then i added values.put("photo", "@drawable/icon");
.
Then in EmployeeDetails
i added this line :
photo = (ImageView) findViewById(R.id.image);
photo.setTag(cursor.getString(cursor.getColumnIndex("photo")));
Of course i imported ImageView
and protected ImageView photo;
and for the Details layout i added:
<ImageView
android:id="id/image
android:layout_width="wrap_content"
android:layout_heigh=wrap_content
Ask if i didn't managed to make myself clear enough. I was trying to put a photo for the details section of the employee I wasn't trying to make a thumbnail image yet the thing is , i did the whole thing and it came out without errors but when i run it , the app crashes.