my code:
- Code: Select all
public class Gallery1 extends Activity {
private ViewFlipper mFlipper;
private Context context;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gallery_1);
// Reference the Gallery view
Gallery g = (Gallery) findViewById(R.id.gallery);
// Set the adapter to our custom adapter (below)
g.setAdapter(new ImageAdapter(this));
g.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView parent, View v, int position, long id) {
mFlipper = ((ViewFlipper)findViewById(R.id.flipper));
mFlipper.setInAnimation(AnimationUtils.loadAnimation(context,
R.anim.push_left_in));
mFlipper.setOutAnimation(AnimationUtils.loadAnimation(context,
R.anim.push_left_out));
mFlipper.startFlipping(); }
});
// We also want to show context menu for longpressed items in the gallery
registerForContextMenu(g);
}
I think the problem is context.But I changed it to the following:
[img]E:problem[/img]
plz tel me
thx in andvance
PS:I got a little bit difficult in inserting a picture ╯﹏╰

