Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6168063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:37:19+00:00 2026-05-23T22:37:19+00:00

Activity 2 public class Menus extends Activity { //set constants for MediaStore to query,

  • 0

Activity 2

         public class Menus extends Activity {
//set constants for MediaStore to query, and show videos
private final static Uri MEDIA_EXTERNAL_CONTENT_URI = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
private final static String _ID = MediaStore.Video.Media._ID;
private final static String MEDIA_DATA = MediaStore.Video.Media.DATA;
//flag for which one is used for images selection
private GridView _gallery; 
private Cursor _cursor;
private int _columnIndex;
private int[] _videosId;
private Uri _contentUri;


protected Context _context;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    _context = getApplicationContext();
    _gallery = (GridView) findViewById(R.id.videoGrdVw);
    //set default as external/sdcard uri
    _contentUri = MEDIA_EXTERNAL_CONTENT_URI;
    //initialize the videos uri 
    //showToast(_contentUri.getPath());
    initVideosId();
    //set gallery adapter
    setGalleryAdapter();
}
private void setGalleryAdapter() {
    _gallery.setAdapter(new VideoGalleryAdapter(_context));
    _gallery.setOnItemClickListener(_itemClickLis);

}
private AdapterView.OnItemClickListener _itemClickLis = new OnItemClickListener() 
{
    public void onItemClick(AdapterView<?> parent, View v, int position, long id) 
    {
        // Now we want to actually get the data location of the file
        String [] proj={MEDIA_DATA};
        // We request our cursor again
        _cursor = managedQuery(_contentUri,
                proj, // Which columns to return
                null,       // WHERE clause; which rows to return (all rows)
                null,       // WHERE clause selection arguments (none)
                null); // Order-by clause (ascending by name)
        // We want to get the column index for the data uri
        int count = _cursor.getCount();
        //
        _cursor.moveToFirst();
        //
        _columnIndex = _cursor.getColumnIndex(MEDIA_DATA);
        // Lets move to the selected item in the cursor
        _cursor.moveToPosition(position);

        Intent data = new Intent(getBaseContext(), Editor.class); data.putExtra("mnt/sdcard-ext", _ID); startActivity(data);
    }
};
private void initVideosId() {
    try
    {
        //Here we set up a string array of the thumbnail ID column we want to get back
        String [] proj={_ID};
        // Now we create the cursor pointing to the external thumbnail store
        _cursor = managedQuery(_contentUri,
                proj, // Which columns to return
                null,       // WHERE clause; which rows to return (all rows)
                null,       // WHERE clause selection arguments (none)
                null); // Order-by clause (ascending by name)
        int count= _cursor.getCount();
        // We now get the column index of the thumbnail id
        _columnIndex = _cursor.getColumnIndex(_ID);
        //initialize 
        _videosId = new int[count];
        //move position to first element
        _cursor.moveToFirst();          
        for(int i=0;i<count;i++)
        {           
            int id = _cursor.getInt(_columnIndex);
            //
            _videosId[i]= id;
            //
            _cursor.moveToNext();
            //
        }
    }catch(Exception ex)
    {

    }

}


//
private class VideoGalleryAdapter extends BaseAdapter
{
    public VideoGalleryAdapter(Context c) 
    {
        _context = c;
    }
    public int getCount() 
    {
        return _videosId.length;
    }
    public Object getItem(int position) 
    {
        return position;
    }
    public long getItemId(int position) 
    {
        return position;
    }
    public View getView(int position, View convertView, ViewGroup parent) 
    {
        ImageView imgVw= new ImageView(_context);;
        try
        {
            if(convertView!=null)
            {
                imgVw= (ImageView) convertView;
            }
            imgVw.setImageBitmap(getImage(_videosId[position]));
            imgVw.setLayoutParams(new GridView.LayoutParams(96, 96));
            imgVw.setPadding(8, 8, 8, 8);
        }
        catch(Exception ex)
        {
            System.out.println("StartActivity:getView()-135: ex " + ex.getClass() +", "+ ex.getMessage());
        }
        return imgVw;
    }

    // Create the thumbnail on the fly
    private Bitmap getImage(int id) {
        Bitmap thumb = MediaStore.Video.Thumbnails.getThumbnail(
                getContentResolver(),
                id, MediaStore.Video.Thumbnails.MICRO_KIND, null);
        return thumb;
    }

}

}

Activity 3

       public class Editor extends Activity {

private VideoView video;
private MediaController ctlr;
ImageButton video1;
int isClicked = 0;
ImageButton audio;
int isClicked1 = 0;
int data = getIntent(data).getExtras() 
    .getInt("mnt/sdcard-ext"); 

    @Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    getWindow().setFormat(PixelFormat.TRANSLUCENT);
    setContentView(R.layout.editor);


    video1 = (ImageButton) findViewById(R.id.video);
    video1.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            if (isClicked == 0) {
                video1.setImageResource(R.drawable.video_pressed);
                isClicked = 1;
            } else {
                video1.setImageResource(R.drawable.video1);
                isClicked = 0;
            }
          }
     });

    audio = (ImageButton) findViewById(R.id.audio);
    audio.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            if (isClicked1 == 0) {
                audio.setImageResource(R.drawable.audio_pressed);
                isClicked1 = 1;
            } else {
                audio.setImageResource(R.drawable.audio);
                isClicked1 = 0;
            }
        }
      });

    if (clip.exists()) {
          video=(VideoView)findViewById(R.id.video);
          video.setVideoPath(clip.getAbsolutePath());

     ctlr=new MediaController(this);
     ctlr.setMediaPlayer(video);
     video.setMediaController(ctlr);
     video.requestFocus();
     video.start();
    }
  }
 }

I am never gonna be a programmer i’m just trying to pass this class. So don’t worry. I need to know how to pass this intent data through to the third activity, but i’m not sure where to put the Extras and get extras.

Android Manifest

              <activity 
      android:name=".Editor"
      android:screenOrientation="landscape" >
       <intent-filter>
      <action 
  android:name="com.ave.Editor" />
      <category 
  android:name="android.intent.category.DEFAULT" />
        </intent-filter>

If you need anymore information let me know. I’m tried of messing with this confusing crap. And any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:37:19+00:00Added an answer on May 23, 2026 at 10:37 pm
     Intent data = new Intent(getBaseContext(), Editor.class); data.putExtra("mnt/sdcard-ext", _ID); startActivity(data);
    

    I find it to be easier to expand this.

    Intent i=new Intent(this, Editor.class);
    i.putExtra("data1", _ID);
    startActivity(data);
    

    In the other Activity:

    public void onCreate(Bundle icicle)
    {
        //===setting content view, any other setup you wanna do
        Intent i=getIntent();
        String data=i.getStringExtra("data1");
    
        if(data!=null)
            //do something with it
        else
            //the data is null; don't do anything with it or you'll get a NullPointerException
    }
    

    I think this is what you wanna do. If not, tell me!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class Menus extends Activity { //set constants for MediaStore to query, and show
I have an activity: public class Notepadv1 extends ListActivity { public static final int
public class VideoDemo extends Activity { private VideoView video; private MediaController ctlr; File clip=new
I've got the following method... public class Image extends Activity { public void onCreate(Bundle
I have a list of objects called Activity: class Activity { public Date activityDate;
This is my problem: class main extends menuActivity{ // .. // public void onActivityResult(int
I have a class that extends Activity and inflates another xml layout in the
Going round in circles here i think. I have an activity called Locate; public
I have an activity that has a TabHost containing a set of TabSpecs each
Sampling with Activity Monitor/Instruments/Shark will show stack traces full of C functions for the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.