Hi i am very new to android so i dont know much about it
my question is
How do i store an image and related sound, text somewhere and get it back to display
and how to implement the next button when its pushed the next image with next sound and text is displayed.
thank you !
Keep images (drawables) ids in an array e.g Array array = new Array(){R.id.one, R.id.two};
Keep your sound file in res/raw folder and put sound id as same above in an array.
E.g. Array sound_array = new Array(){R.raw.horn_sound, R.id.peep_sound};
Keep counter and loop over the arrays....
Related
FireStore Array
I already retrieve the vaccine name and the number of count but the problem is the SPACE is also replace or being removed.
Retrived
I WANT TO OUTPUT THE ITEM LIKE THIS
WITH SPACE SAME VALUE IN THE FIRE STORE
I ALREADY GET IT USING THIS CODE BELOW IT I HOPE YOU GET THE POINT OF THE CODE BELOW CLICK THE LINKED TEXT TO SEE IT
IMAGE FOR THE CODE
Basically I used the Character.isDigit, isAlphabetic, isWhiteSpace
then save it to stringbuffer. then save it to my textview
I assigned my buffer variable for text to get also the whitespace.
My app contains the camera functionality. I have develop the app.
As the app get starts one ListView of stations will popup(Like Station1, Station2,Station3....) & user has select one item from it. Then it will open the camera activity. So once the user took a picture, the image has to be stored like 'Station1_1', 'Station1_2', 'Station2_1', 'Station2_2' inside gallery. I have covered with the initial station name(Station1, station2..). But how do I store the last portion because it contains the sequence for each Station. So is there any way to save the images by 1,2,3....?
Thanks in advance.
There is a way but it isn't appropriate. If you just want to store each image having last portion is different then you can do in the following ways:-
You can call API for just handling counter.
You can store counter in PREFERENCE, but it won't work perfect if user clear data then new images were override old one.
You can store TIMESTAMP as end portion and it is appropriate way.
so I'm currently working on a project... I want to create an Array containing the Ids of videos from a youtube playlist.. Also i wanna download a specific video when user click on download button, how can i do that?
Also, another question:
I have created a ListView, and set when the user click on one of the rows, String clicked = videoIds.get(position);. But i want to get the clicked string to use in another methods, like when he clicks the download button, how can i do that too?
Thanks for reading :)
https://www.youtube.com/t/terms
You shall not download any Content unless you see a “download” or similar link displayed by YouTube on the Service for that Content.
I have a UI with 9 image buttons with images of numbers from 1 to 9..I have a button listen which on click should play mp3 files (of number between 1 to 9) randomly on each click.I should have 5 such random mp3 files playing when i click the listen button 5 times.Problem is "i have to match the randomly generated mp3 files with the image button containing the image of correct number how do i do this...because only randomly generated are the mp3 files while the image buttons are not randomly shuffled...there remain static in their position....please help me...
Think of code as a modeling tool like clay or building block. If you craft it, it will exist. So what you really need, is an informational construct that matches what you are trying to do. So you could theoretically create a class that contains a reference to a button id, image and an mp3 file. When this object is created, generate the button ID randomly in the constructor, then you can write a function that writes one of these objects to the UI (creates the button, assigns the objects image, etc). Then when someone clicks a button, all you need to do is look for the object with the same id as your button, and get the mp3 or image back out of it.
onclick of the listen generate random numbers using below code
var=(int)(Math.random() * (max - min) + min) //math.random will return integer values
-now your variable will have random no between your max and min value i.e 1-9
-you can use switch case as below
and let the image button remain as it is...if only randomly generated are mp3 files just loop through and select file randomly again.
switch (var)
{
case 1:
//your code
break;
.
.
.
default:
//your code
break;
}
I have a Android Air project written in AS3, when the project starts I am loading the music and loading the XML file to be parsed. In the first frame I call my classes to parse the XML and set the nodes at strings, and to play the audio, these both work fine. Also in my first frame I am declaring some textfields to input the data from the XML file so that when the user enters frame 3 the user is able to see this data from the XML file. This also works fine. The problem I am having is going between frame 4 and back to frame 3, the data in the textfields disapears? I trace the strings from the XML class that are holding the data and these values appear everytime, but going from frame 3 to frame 4 and back to frame 3 wipes out the textfield display? Can anyone point me in the right direction?
thanks
Scientific
Ok here is some code from frame one where I am declaring the textfields
var name1TextField:TextField = new TextField();
var name2TextField:TextField = new TextField();
var format:TextFormat = new TextFormat();
format.font = "_sans";
format.color = 0xF8FBF8;
format.size = 36;
//set the names format to the textfields
name1TextField.defaultTextFormat = format;
name2TextField.defaultTextFormat = format;
highScore1.addChild(name1TextField);
highScore2.addChild(name2TextField);
Here is the code calling the XML parsing class and setting the text to the nodes
var network:networkScores = new networkScores();
addChild(network);
var timer4:Timer = new Timer(600);
timer4.addEventListener(TimerEvent.TIMER, scoresDis);
timer4.start();
function scoresDis(e:TimerEvent):void
{
name1TextField.text = network.name1;
name2TextField.text = network.name2;
//trace(name1TextField.text);
//trace(name2TextField.text);
name1TextField.width = 230;
name2TextField.width = 230;
timer4.stop();
}
Previously above I had stated that I am calling the audio class and the xml class from the first frame, declaring the text fields and moving on from there. Now I have decided that since this XML file is a list of scores and coded be always changing, I thought it would be good to load and parse this file everytime I enter frame 3. The same thing is still happening, I have my scores display and then when I go to frame 4 and back to frame three, the scores do not display, but when I trace the data from the class, it displays properly.
Thanks
Scientific
I've seen this issue happen before with improperly embedded fonts or something, I can't recall exactly. A quick way to test this would be to trace out the .text property of the fields too. This way, when the text isn't visible, if the .text property of the field is still populated then you know you've got a rendering problem.
Do this quick test and post the results, I'll update my answer with more information depending on the outcome.