Well, what I want to do is this. I want to create an image through the app.
To create this image, the user will choose 3 images. Then to choose them, he will have to go through Activity1 and choose the first image. When it chooses, it writes the image to a variable or putextra
as I was thinking of doing and opens to Activity2. Do it again for Activity3. So. Is it possible to have multiple putextra
moving from Activity to Activity? These images come from a url stored in the database.
I currently do something like putextra
, but it's just an activity and an image.
So:
listView1.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//passa "name" para a classe Detail fazer uma busca;
intent = new Intent(getContext(), Detail.class);
intent.putExtra("name", names.get(position));
intent.putExtra("update", true);
startActivity(intent);
}
});
In the Detail class:
isUpdate = getIntent().getBooleanExtra("update", false);
if (isUpdate) {
databaseAccess.open();
//aqui pega o "name" e faz uma busca no banco pra trazer a imagem
data = getIntent().getStringExtra("name");
getimage = databaseAccess.getImageS(data);
Retrieving the image:
//aqui recupera a imagem e de volta em detail seto ela num
// imageview via Picasso
public String getImageS(String name) {
String data = null;
Cursor cursor = database.rawQuery("SELECT imagem FROM Armas WHERE nome = ?", new String[]{name});
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
data = cursor.getString(0);
break;
}
cursor.close();
return data;
}