[android-beginners] Add ListView to RelativeLayout

2010-07-02 Thread Kritzli
Hi there,

I'm having trouble to add a listview to a relativelayout. Ok, not
adding itself is the problem. I'm not able to fill it with my data. I
receive my data from a query to a webservice where i get a list of
books as response. In my listview i want to display just the title of
these books.
And there's the problem. If I'm trying it with

listView.setAdapter(this, android.R.layout.simply_list_item1,
listBook);

I just get the id or value of those books.
I also tried to achieve it with listAdapters but... I need a little
guide for that.
Or maybe I'm totally in the wrong direction and I need a class which
extends listActivity with an EditView to generate my query and not a
listView within a RelativeLayout ?

I would be very grateful for any kind of help :)

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Enlarge/Shrink button size with onLongClick

2010-01-04 Thread Kritzli
Hi,

I'm going to create a custom keyboard app. One feature is, that an
user can resize the keys.
Currently I'm doing this by firstly creating a button, which can be
resized and letters can be entered. In the second step, the button
should be transformed into a key. Resizing is done by two buttons,
making by onClick the "Key-Button" bigger and smaller. But i think
it's very annoying to do 20 clicks if you want a 20 times bigger
button.
So i tried to use onLongClick, that if a resize button is pushed and
held, the "Key-Button" should be resized.

But my problem at the moment is, that the onLongClickListener-method
doesn't work properly. I tried it like this:

 zoomin_button.setOnLongClickListener(new OnLongClickListener(){

public boolean onLongClick(View v){
int height = current_button.getHeight();
int width = current_button.getWidth();
boolean longclick = true;

while(longclick == true){
current_button.setHeight(height+2);
current_button.setWidth(width+2);
}
Toast.makeText(BApp.this, "Long Click", 
Toast.LENGTH_SHORT).show();
return true;
}
  });


If I do it like this, after a short time I get a message which says:
"Activity xy doesn't react".
While I tried it like:

 zoomin_button.setOnLongClickListener(new OnLongClickListener(){

public boolean onLongClick(View v){
int height = current_button.getHeight();
int width = current_button.getWidth();

current_button.setHeight(height+2);
current_button.setWidth(width+2);

Toast.makeText(BApp.this, "Long Click", 
Toast.LENGTH_SHORT).show();
return true;
}
  });

The Toast shows up but the button isn't resized.

Okai. If you have any suggestion how this can be solved I would be
deeply grateful !

Thanks in advance !

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] ArrayList items are missing

2010-01-26 Thread Kritzli
At the moment, I have two Activities (Activity A and B). At the
Activity A I customize a button and pass it on Activity B via an
intent. On Activity B I move the button somewhere on the screen. This
will be done with other buttons. So I want to save some attributes of
a button like height, width and alignment.

I tried to save them in an ArrayList but everytime I access the
ArrayList after changing back from Activity B to Activity A to create
a second button, the ArrayList is empty.

How could I achieve the ArrayList isn't loosing it's items ?
I think the worst idea is, to make an Intent with that ArrayList
sending it to Activity A.The List is getting bigger and bigger and I
start to loose performance.

Any suggestion how this can be solved ?

I would be deeply grateful and thanks in advance !

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: ArrayList items are missing

2010-02-02 Thread Kritzli
Thank you ! Static was the magic word. And after eliminating some
other errors the buttons are also shown on my activity :)

On 26 Jan., 23:41, Yousuf Faheem  wrote:
> Hi,
>
> one thing that you can do is make the Arraylist static
> or send the information to the next activity using a bundle and again send
> it to your activity
> or use storedpreferences.
>
> Thanks,
>
> Yousuf.
>
> On Tue, Jan 26, 2010 at 2:18 PM, Kritzli 
> wrote:> At the moment, I have two Activities 
> (Activity A and B). At the
> > Activity A I customize a button and pass it on Activity B via an
> > intent. On Activity B I move the button somewhere on the screen. This
> > will be done with other buttons. So I want to save some attributes of
> > a button like height, width and alignment.
>
> > I tried to save them in an ArrayList but everytime I access the
> > ArrayList after changing back from Activity B to Activity A to create
> > a second button, the ArrayList is empty.
>
> > How could I achieve the ArrayList isn't loosing it's items ?
> > I think the worst idea is, to make an Intent with that ArrayList
> > sending it to Activity A.The List is getting bigger and bigger and I
> > start to loose performance.
>
> > Any suggestion how this can be solved ?
>
> > I would be deeply grateful and thanks in advance !
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Beginners" group.
>
> > NEW! Try asking and tagging your question on Stack Overflow at
> >http://stackoverflow.com/questions/tagged/android
>
> > To unsubscribe from this group, send email to
> > android-beginners+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-beginners?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Button properties not set properly

2010-02-03 Thread Kritzli
After solving the problem with the invisible ArrayList, the next
problem occurred. Situation is still the same:

There are two Activities (Activity A and B). At Activity A I customize
a button and pass it on Activity B via an intent. On Activity B I move
the button somewhere on the screen. This
will be done with other buttons. On Activity B I also want to show the
old Buttons.

Thats the code:

 if(keyList.isEmpty() == false){
for (iter = keyList.iterator(); iter.hasNext();){

Button k =  (Button) iter.next();
Button ok = new Button(this);

ok.setHeight(k.getHeight());
Log.i("Button K", "Height: " + k.getHeight());
Log.i("Button OK", "Height: " + ok.getHeight());

ok.setWidth(k.getWidth());
ok.setText(k.getText());
ok.layout(k.getLeft(), k.getTop(), 
k.getRight(), k.getBottom
());
ok.setVisibility(1);

rel_layout.removeView(ok);
rel_layout.addView(ok);

   }

But there are two problems:
1. The properties are not set properly
With
  ok.setHeight(k.getHeight());
Log.i("Button K", "Height: " + k.getHeight());
Log.i("Button OK", "Height: " + ok.getHeight());

I get
  Button K Height = 48
  Button OK Height = 0

At my Activity it is set correctly but here...

2. As above mentioned, I want to move the Buttons and set them
somewhere on the screen (e.g. down right). But everytime I call
Acitvity B again, all Buttons are located at top left.
I thought it would be achieved with
  ok.layout(k.getLeft(), k.getTop(), k.getRight(), k.getBottom());

But obviously not.


Any suggestion and hints how this could be solved would be
appreciated !

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Create soft keyboard dynamically

2010-03-16 Thread Kritzli
Hi,

it's me again, with a new question. (I hope its not double posted,
cause for the last one i got a "post rejected" mail)
Ok, here's the Question:
Is it possible to write an Softkeyboard without XML or is this the
time i'll need it ?

The idea is:
I have an Arraylist with buttons which have a specific position in the
layout, height, width, text etc.
Those buttons should create my keyboard by converting them into keys.

If this won't work, my second idea is, to write a XML-File out of
Java.


I wonder if one of these ideas are possible.


Thanks in advance for any kind of help !

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] How to save a file to res/raw ?

2010-03-30 Thread Kritzli
Hey,

After reading so many tutorials about how to read a file from res/raw,
i'm still wondering how i can write a file to res/raw.

At the moment I'm saving my file like this to the emulator:

 FileOutputStream fos = null;
 OutputStreamWriter osw = null;

 try{
 fos = openFileOutput(filename + ".xml", MODE_WORLD_READABLE);
 osw = new OutputStreamWriter(fos);

 ... //some code
   }


But the problem is, i need to read it from another class, which only
accepts xml - files.

I would be very glad if someone could help me.

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

To unsubscribe from this group, send email to 
android-beginners+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.


[android-beginners] Re: How to save a file to res/raw ?

2010-03-31 Thread Kritzli
Thanks for your replies. That are bad news for me.
Hm, if i cant't save them to res/raw directory, i still can write and
read them to the local data store, can't i ?
I mean can I access data/data//files/ ?

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

To unsubscribe, reply using "remove me" as the subject.


[android-beginners] Re: How to save a file to res/raw ?

2010-03-31 Thread Kritzli
Great. This is what I wanted to know :)

But, there's the next question.
I'm still trying to create a custom soft keyboard. Therefore I need
that xml - file. But how do I load my custom layout file into that ?
I mean, the constructor only accepts an int ID.
Like

mQwertyKeyboard = new custom_keyboard(this, R.xml.qwert);

If I try to put my xml file via FileReader or the like to the
constructor, I get an error. Is there a way I can generate an ID or
use my xml file ?



-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: How to save a file to res/raw ?

2010-03-31 Thread Kritzli
hm, but if i can't write a file to res/layout/ , how can i load my
layout ?
I think there's the same read-only restriction to res/layout as to res/
raw, isn't it ?

On 31 Mrz., 21:50, Mark Murphy  wrote:
> Kritzli wrote:
> > Great. This is what I wanted to know :)
>
> > But, there's the next question.
> > I'm still trying to create a custom soft keyboard. Therefore I need
> > that xml - file. But how do I load my custom layout file into that ?
> > I mean, the constructor only accepts an int ID.
> > Like
>
> > mQwertyKeyboard = new custom_keyboard(this, R.xml.qwert);
>
> > If I try to put my xml file via FileReader or the like to the
> > constructor, I get an error. Is there a way I can generate an ID or
> > use my xml file ?
>
> You cannot load dynamic layouts this way. You can only use
> LayoutInflater viares/layout/ resources.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android 2.x Programming Books:http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: How to save a file to res/raw ?

2010-04-01 Thread Kritzli
I'm not sure if it's possible to rewrite the code in java.
Looking up at the Doc, if there's a way to create a keyboard without
any xml I found this one:

>> public  Keyboard  (Context  context, int layoutTemplateResId, CharSequence  
>> characters, int columns, int horizontalPadding)

but, >int layoutTemplateResId< says (if I understand aright), I'll
need an ID again, like the one in

>> mQwertyKeyboard = new custom_keyboard(this, R.xml.qwert);


Although it creates an empty Keyboard. Very confusing...


-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

To unsubscribe, reply using "remove me" as the subject.


[android-beginners] Re: How to save a file to res/raw ?

2010-04-02 Thread Kritzli
Hm, good idea. I don't know if it's possible.
But I'll give it a try.

On 2 Apr., 01:02, Sebastián Treu  wrote:
> On Thu, Apr 1, 2010 at 9:05 AM, Kritzli  wrote:
> > I'm not sure if it's possible to rewrite the code in java.
> > Looking up at the Doc, if there's a way to create a keyboard without
> > any xml I found this one:
>
> >>> public  Keyboard  (Context  context, int layoutTemplateResId, 
> >>> CharSequence  characters, int columns, int horizontalPadding)
>
> > but, >int layoutTemplateResId< says (if I understand aright), I'll
> > need an ID again, like the one in
>
> >>> mQwertyKeyboard = new custom_keyboard(this, R.xml.qwert);
>
> > Although it creates an empty Keyboard. Very confusing...
>
> Sorry, this may sound stupid but, can't you just create a keyboard
> with a foo layout and then set it with the options of your custom xlm
> file parsed?
>
> --
> If you want freedom, compile the source. Get gentoo.
>
> Sebastián Treuhttp://labombiya.com.ar

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

To unsubscribe, reply using "remove me" as the subject.