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 8267577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:35:02+00:00 2026-06-08T05:35:02+00:00

07-23 05:01:10.925: E/AndroidRuntime(4520): FATAL EXCEPTION: main 07-23 05:01:10.925: E/AndroidRuntime(4520): java.lang.RuntimeException: Unable to instantiate activity

  • 0

07-23 05:01:10.925: E/AndroidRuntime(4520): FATAL EXCEPTION: main
07-23 05:01:10.925: E/AndroidRuntime(4520):
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{nsixty.crew.app/nsixty.crew.app.gallery}:
java.lang.NullPointerException 07-23 05:01:10.925:
E/AndroidRuntime(4520): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
07-23 05:01:10.925: E/AndroidRuntime(4520): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1680)
07-23 05:01:10.925: E/AndroidRuntime(4520): at
android.app.ActivityThread.access$1500(ActivityThread.java:117) 07-23
05:01:10.925: E/AndroidRuntime(4520): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
07-23 05:01:10.925: E/AndroidRuntime(4520): at
android.os.Handler.dispatchMessage(Handler.java:99) 07-23
05:01:10.925: E/AndroidRuntime(4520): at
android.os.Looper.loop(Looper.java:130) 07-23 05:01:10.925:
E/AndroidRuntime(4520): at
android.app.ActivityThread.main(ActivityThread.java:3703) 07-23
05:01:10.925: E/AndroidRuntime(4520): at
java.lang.reflect.Method.invokeNative(Native Method) 07-23
05:01:10.925: E/AndroidRuntime(4520): at
java.lang.reflect.Method.invoke(Method.java:507) 07-23 05:01:10.925:
E/AndroidRuntime(4520): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
07-23 05:01:10.925: E/AndroidRuntime(4520): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) 07-23
05:01:10.925: E/AndroidRuntime(4520): at
dalvik.system.NativeStart.main(Native Method) 07-23 05:01:10.925:
E/AndroidRuntime(4520): Caused by: java.lang.NullPointerException
07-23 05:01:10.925: E/AndroidRuntime(4520): at
nsixty.crew.app.gallery.(gallery.java:49) 07-23 05:01:10.925:
E/AndroidRuntime(4520): at java.lang.Class.newInstanceImpl(Native
Method) 07-23 05:01:10.925: E/AndroidRuntime(4520): at
java.lang.Class.newInstance(Class.java:1409) 07-23 05:01:10.925:
E/AndroidRuntime(4520): at
android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-23 05:01:10.925: E/AndroidRuntime(4520): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1578)
07-23 05:01:10.925: E/AndroidRuntime(4520): … 11 more

public class gallery extends ListActivity {

private List<String> item = null;

private List<String> path = null;

private String root = "sdcard/Crews/";

private TextView myPath;
VideoView videoView;

String[] itemArr;

String[] itemArr2 = item.toArray(new String[item.size()]);
ListView list;

File folder = new File("sdcard/Crews/Videos/");

MyThumbnaildapter fileList;

/** Called when the activity is first created. */

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.gallery);
    myPath = (TextView) findViewById(R.id.path);

    getDir(root);

    videoView = (VideoView) this.findViewById(R.id.videoView);

}

private void getDir(String dirPath)

{

    myPath.setText("Location: " + dirPath);

    item = new ArrayList<String>();

    path = new ArrayList<String>();

    File f = new File(dirPath);

    File[] files = f.listFiles();

    if (!dirPath.equals(root))

    {

        item.add(root);

        path.add(root);

        path.add(f.getParent());

    }

    for (int i = 0; i < files.length; i++)

    {

        File file = files[i];

        path.add(file.getPath());

        if (file.isDirectory()) {

            item.add(file.getName() + "/");
        }

        else {

            item.add(file.getName());
        }

    }

    fileList = new MyThumbnaildapter(this, R.layout.row, itemArr2);
    setListAdapter(fileList);
    list = (ListView) findViewById(android.R.id.list);

    list.setAdapter(fileList);
    registerForContextMenu(list);

}

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    final File file = new File(path.get(position));

    if (file.isDirectory())

    {

        if (file.canRead()) {

            getDir(path.get(position));
            // imageThumbnail.setImageBitmap(bmThumbnail);
        }

        else

        {

            new AlertDialog.Builder(this)

            .setIcon(R.drawable.icon)

            .setTitle("[" + file.getName() + "] folder can't be read!")

            .setPositiveButton("OK",

            new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {

                    // TODO Auto-generated method stub

                }

            }).show();

        }

    }

    else

    {

        new AlertDialog.Builder(this)

        // .setIcon(R.drawable.icon)
        // .setView(getCurrentFocus())
                .setTitle("[" + file.getName() + "]")

                .setPositiveButton("OK",

                new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                        if (file.getPath().contains(".3gp")) {

                            Intent intent = new Intent();
                            intent.setAction(Intent.ACTION_VIEW);

                            intent.setDataAndType(
                                    Uri.fromFile(new File(file.getPath())),
                                    "video/*");

                            startActivity(intent);

                        } else if (file.getPath().contains(".jpg")) {
                            Intent intent = new Intent();
                            intent.setAction(Intent.ACTION_VIEW);

                            intent.setDataAndType(
                                    Uri.fromFile(new File(file.getPath())),
                                    "image/*");

                            startActivity(intent);
                        } else {
                            Toast displayError = Toast.makeText(
                                    gallery.this, "unsupported media type",
                                    Toast.LENGTH_SHORT);
                            displayError.show();
                        }

                    }

                }).show();
        // });
    }

}

}

public class MyThumbnaildapter extends ArrayAdapter<String> {

    public MyThumbnaildapter(Context context, int textViewResourceId,
            String[] objects) {
        super(context, textViewResourceId, objects);
        // TODO Auto-generated constructor stub
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub

        View row = convertView;
        if (row == null) {
            LayoutInflater inflater = getLayoutInflater();
            row = inflater.inflate(R.layout.row, parent, false);
        }



        ImageView imageThumbnail = (ImageView) row
                .findViewById(R.id.Thumbnail);


        Bitmap bmThumbnail;
        bmThumbnail = ThumbnailUtils.createVideoThumbnail(
                itemArr2[position], Thumbnails.MICRO_KIND);
        imageThumbnail.setImageBitmap(bmThumbnail);

        return row;
    }

}
  • 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-06-08T05:35:04+00:00Added an answer on June 8, 2026 at 5:35 am

    Blindly assumption,

    fileList = new MyThumbnaildapter(this, R.layout.row, itemArr2);
    

    Your itemArr2 is null, because, you are trying to initiate it globally before fill item array..
    like,

    String[] itemArr2 = item.toArray(new String[item.size()]);
    

    Solution (May be):

    put String[] itemArr2 = item.toArray(new String[item.size()]);
    line after filling item string array,

    So it should be here,

    String[] itemArr2 = item.toArray(new String[item.size()]);
    fileList = new MyThumbnaildapter(this, R.layout.row, itemArr2);
    setListAdapter(fileList);
    

    Also remove these two lines,

    list = (ListView) findViewById(android.R.id.list);
    list.setAdapter(fileList);
    

    Debug your application code, and find out the problems..

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

Sidebar

Related Questions

It's now 925*1139,I want to change it to 90*110.
I'm trying the basic jMonkey but I get this exception jun 27, 2012 9:25:08
I installed the VTK toolkit and I use the Java wrapper for VTK in
I'm using JBoss 4.0.5 GA on Windows 7 with Java version 1.5 (I have
I just don't know why i get this error: 2010-10-28 16:32:29,925 ERROR [ache.commons.digester.Digester.error :1635]
Jackson is throwing a weird exception that I don't know how to fix. I'm
Download the source code with compiled executable (221 KB (226,925 bytes)): http://www.eyeclaxton.com/download/delphi/skeleton.zip Why doesn't
I hacked up a recursive function in Java for a homework problem in my
Just want to let everyone know this is the first app I am trying
I can't find any documentation of the following problem I'm having with the axis

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.