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

  • Home
  • SEARCH
  • 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 5949485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:15:24+00:00 2026-05-22T17:15:24+00:00

In my Android application I have a large String containing the source of a

  • 0

In my Android application I have a large String containing the source of a webpage of mine. This webpage using javascript rotates a six transparent png’s over the top of a few other png’s. What I want to do is extract the last 4 characters of the png file names, but ONLY for the first 6 images that appear in the source code. These last 4 characters of each png file name are a time stamp that i need and want to read them into an array.

Source:

<html><head><style>html {background: black} body {background:black;margin:0;padding:0;}</style><script>setInterval('changeImage()',1000);function changeImage() {size = images.length;if (current == size-1) { current = -1;}current++;document.getElementById('rad').src = images[current];    }current = 0;images = new Array();images[0] = 'image.201105261318.png';images[1] = 'image.201105261323.png';images[2] = 'image.201105261330.png';images[3] = 'image.201105261336.png';images[4] = 'image.201105261342.png';images[5] = 'image.201105261348.png';</script></head><body><img style="position:absolute; top: 0px; left: 0px;z-index:1;" src="http://background.png"></body></html>

Desired output:

String Array = "1318,1323,1330,1336,1342,1348"

I have tried a lot of different substring retrieval methods, but still am struggling. I know how to identify the end of the string using “.png” but not sure how to say that i want just the 4 chars preceding that delimiter..?

Any help would be greatly appreciated.

Cheers

Greg

EDIT:

Got It!

int delimiter = source.indexOf(".png");
String imageTime1 = source.substring(delimiter-4,delimiter);
int delimiter2 = source.indexOf(".png",delimiter+4);
String imageTime2 = source.substring(delimiter2-4,delimiter2);
int delimiter3 = source.indexOf(".png",delimiter2+4);
String imageTime3 = source.substring(delimiter3-4,delimiter3);
int delimiter4 = source.indexOf(".png",delimiter3+4);
String imageTime4 = source.substring(delimiter4-4,delimiter4);
int delimiter5 = source.indexOf(".png",delimiter4+4);
String imageTime5 = source.substring(delimiter5-4,delimiter5);
int delimiter6 = source.indexOf(".png",delimiter5+4);
String imageTime6 = source.substring(delimiter6-4,delimiter6);

Cheers

  • 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-22T17:15:25+00:00Added an answer on May 22, 2026 at 5:15 pm

    Perhaps I am missing the point, but…

    Given index x being the text.indexOf(“.png”), you can simply use text.substring(x-4,x);.

    Then you can do text.indexOf(".png",x+4) to get your next image end, and repeat the above.

    If possible case variations are a concern you could change the entire string to upper or lower case before searching for your extension.

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

Sidebar

Related Questions

I have a Web Service and an Android application that uses this web service.
I want to integrate the zxing source code to my Android application. I have
I have a style applied to my whole application: AndroidManifest.xml: <application android:theme=@style/ApplicationStyle android:icon=@drawable/icon android:label=@string/app_name>
i have problem using camera in my Android application i have a form for
I have an Android Application that has four activities. None is very large and
I'll try to be brief: In my android application I have a large amount
I am developing an android application in which i have to show large data
I have an android application that begins by downloading a large database to the
I have an Android application which uses the NDK to execute a large amount
I have an Android application with version 1.6 I take the wallpaper and show

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.