Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

D Hagy

Greenhorn
+ Follow
since Jul 05, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by D Hagy

I need to have two arraylists. I declared them. I declared a "mine" arraylist and an "user" arraylist with this code:



I want to store in these values, what are will be important to contact with the user:
I added values to my mine arraylist:


I want to add a values to the user named arraylist if the user press a button. So I added this code:

and
to an another button.

I added two line to the buttons so I can follow how the arraylist looks like in the appropriate moments.

Then if the user clicks an another button, I want to compare these lists, so I implemented the following code:


If the two arraylists are the same in the order and in values, I want to show a new screen (its name is for example good), and if not I want to show an another( its name is for example lose). But I have a problem. My program is only show my lose screen if the user only clicked the button which add 1 to the arraylists, or if he/she only clicked the button which add 0 to the arraylist. How can I make my program to run as I want? Thanks in advance
10 years ago
I have two arraylists like arraylist1 and arraylist2. I need to compare them and if they are not equal I need to take another action, than if they are equal. How I can compare all ints in these arrays and how I can compare them? I think one equal method is not enough.
10 years ago
Nice day!
I tried to show random images in my application in an ImageView. I
tried this code:
public class rr extends Activity{
        ImageView secret;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
                // TODO Auto-generated method stub
                super.onCreate(savedInstanceState);
                setContentView(R.layout.rr);
                TextView txt = (TextView) findViewById(R.id.txt);
                secret = (ImageView) findViewById(R.id.secret);
                Runnable r1 = new Runnable() {
                        @Override
                        public void run() {
                                // TODO Auto-generated method stub
                                int imageArr[] = new int[3];
                                imageArr[0] = R.drawable.r1_mirror;
                                imageArr[1] = R.drawable.s1_mirror;
                                imageArr[2] = R.drawable.p2_mirror;
                                int n = (int) Math.random()*3;
                                secret.setImageResource(imageArr[n]);
                        }
        };
                secret.postDelayed(r1, 5000);
        }
}

But it only show the r1_mirror image, everytime, when I start my
application in the emulator. What I made bad? I thought that it will
working, but.
Thanks for any helps


10 years ago
Hi!

Sorry for the question, but now I can't try it, so I want to ask you, that If I use this code, I will be able to take a photo and display it in the framelayout?


Thanks
10 years ago
I want to take a picture with my app, and then I want to show this picture for the person, and then show over it another pictures. I take a photo , then I convert the byte code to jpeg file, and then I want to show it in an ImageView for the user. I want this image to be visible, but on it i want to show another imageviews. Can I do this in android? If yes how? I think that I can do this, because when I use Googles it take a photo and then show a "scanner" animation on it. Thanks
10 years ago

aruna sameera wrote:this is my main xml file.when i run my project it gives the expected out put.I have attached the screenshot too.But if i change the android:orientation to horizontal it shows blank screen.I have attached that screenshot too.Please advice.



When you change orientation, you need to save the screen's contents, or make a new layout file for horizontal/vertical assigning. Or -> Only the files with assigned ids -> android:id="@+id/button" for a view -> keep they look after the orientation change.
10 years ago
I wrote my first example app, and I try to import in it the Admob ads. I could make that in the Android 2.3.3 graphical layout, that the Ads by Google label is showing instead of com.google...AdView what is showing in every other graphical layout. From 1.6 to 2.2. I don't know why. I thought that my ads will showing only in Android 2.3.3, but wasn't.
Neither in 2.3.3 nor in 2.2 and below. My ad isn't showing in any emulator. But I don't know why, there aren't any error, except what in the 2.2 and lower layouts:

Parser is not a BridgeXmlBlockParser!

The following classes could not be instantiated:
- com.google.ads.AdView
See the Error Log (Window > Show View) for more details.

I don't know what I make bad.

Here is my layout file for this activity:




MY_PUBLISHER_CODE = my own publisher code

In the related java (android) class, I imported the



code.


In the manifest file, I imported this:



and the internet and network access permission.

Please help me, it's very annoying, that I don't know make this.
10 years ago

Nidhi Sar wrote:

D Hagy wrote:I tried to make it with thread, but with the thread I can't change it. Now I tried to make a handler but it's not good either.

Here is the original thread code:



I hope you can understand what I want to do, sorry I'm not perfect english If you can, please give me an alternative code for this. It's very annoying, that only this is what I need for my program, but I can't do this. Sorry if this question, is so easy or something but I'm a beginner programmer.



I didn't actually try it, but when you say " but with the thread I can't change it", I'm assuming that you are getting a CalledFromWrongTreadException (you can see the exception in the LogCat).
The line radar.setImageResource(R.drawable.radar_full); and other two need to run on the UI thread, so replace this single line with the following block - the other two would need to be changed too :



Thanks I could make it!
10 years ago
It produce the stopped unexpectedly problem when I push the search button.


10 years ago

Hardik Trivedi wrote:You can try this.
Thread t=new Thread(new Runnable() {

public void run()
{
try
{
Thread.sleep(2000);// After 2 seconds
//Change Image
Thread.sleep(5000);// After 5 seconds
//Change Image
Thread.sleep(7000);// After 7 seconds
//Change Image
}
catch(Exception e)
{

}
}
});
t.start();



Thanks, I tried it. My application doesn't show any error, or warning, but it's produce the "stopped unexpectedly" error. Can this produce it, or there is an another problem?
10 years ago

Hardik Trivedi wrote:You can try this.
Thread t=new Thread(new Runnable() {

public void run()
{
try
{
Thread.sleep(2000);// After 2 seconds
//Change Image
Thread.sleep(5000);// After 5 seconds
//Change Image
Thread.sleep(7000);// After 7 seconds
//Change Image
}
catch(Exception e)
{

}
}
});
t.start();



Thanks! I will try it tomorrow (ehhmm... today )
10 years ago
I tried to make it with thread, but with the thread I can't change it. Now I tried to make a handler but it's not good either.

Here is the original thread code:



I hope you can understand what I want to do, sorry I'm not perfect english If you can, please give me an alternative code for this. It's very annoying, that only this is what I need for my program, but I can't do this. Sorry if this question, is so easy or something but I'm a beginner programmer.
10 years ago