According to your code, you are not setting the click listener on your
button until you click on the button... Adding the click listener should
also go in your onCreate() method...

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, Jun 13, 2012 at 1:19 PM, Lars <[email protected]> wrote:

> Thank you very much =). It worked=)
>
> But of some reason when i press the dagens_button on my phone it does'nt
> open the attached(dagensbilde.java) activity(which is a webview activity).
> Did i do something wrong in the code i already posted.
>
> Thank you in advance.
>
> Lars.
>
>
>
>
> Den onsdag den 13. juni 2012 20.45.49 UTC+2 skrev Chris Ruskai:
>
>> If that's your entire Activity, I don't see an onCreate function or
>> anything that calls setContentView to tell the app which xml file to use
>> for the activity's layout.
>>
>> For example:
>>
>> @Override
>>  public void onCreate(Bundle savedInstanceState) {
>>         super.onCreate(**savedInstanceState);
>>         setContentView(R.layout.main);
>> }
>>
>> On Wed, Jun 13, 2012 at 11:22 AM, Lars <[email protected]> wrote:
>>
>>> Here's my activity.java:
>>>
>>> package lars.browser;
>>>
>>> import lars.browser.dagensbilde;
>>> import android.app.Activity;
>>> import android.os.Bundle;
>>> import android.content.Intent;
>>> import android.view.View;
>>> import android.view.View.**OnClickListener;
>>>
>>>
>>> public class BrowserActivity extends Activity {
>>>     /** Called when the activity is first created. */
>>>     public void onClick(View v) {
>>>         if (v.getId() == R.id.dagens_button) {
>>> View dagens_button = findViewById(R.id.dagens_**button);
>>>  dagens_button.**setOnClickListener((**OnClickListener) this);
>>>  Intent i = new Intent(this, dagensbilde.class);
>>> startActivity(i);
>>>
>>> And here's my main.xml
>>>
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <LinearLayout xmlns:android="http://schemas.**
>>> android.com/apk/res/android <http://schemas.android.com/apk/res/android>
>>> "
>>>     android:layout_width="match_**parent"
>>>     android:layout_height="fill_**parent"
>>>     android:background="@color/**background"
>>>     android:orientation="**horizontal"
>>>     android:padding="30dip" >
>>>
>>> <LinearLayout
>>>     android:orientation="vertical"
>>>     android:layout_height="wrap_**content"
>>>     android:layout_width="fill_**parent"
>>>     android:layout_gravity="**center">
>>> <TextView
>>>     android:text="@string/main_**title"
>>>     android:layout_height="wrap_**content"
>>>     android:layout_width="wrap_**content"
>>>     android:layout_gravity="**center"
>>>     android:layout_marginBottom="**25dip"
>>>     android:textSize="24.5sp"/>
>>>
>>>
>>> <Button
>>>     android:id="@+id/nyeste_**button"
>>>     android:layout_width="265dp"
>>>     android:layout_height="wrap_**content"
>>>     android:layout_gravity="**center"
>>>     android:text="@string/nyeste_**text"
>>>     android:textSize="20sp" />
>>>
>>>
>>>     <Button
>>>         android:id="@+id/dagens_**button"
>>>         android:layout_width="265dp"
>>>         android:layout_height="wrap_**content"
>>>         android:layout_gravity="**center"
>>>         android:text="@string/dagens_**text"
>>>         android:textSize="20sp" />
>>>
>>>     <Button
>>>         android:id="@+id/måneds_**button"
>>>         android:layout_width="265dp"
>>>         android:layout_height="wrap_**content"
>>>         android:text="@string/måneds_**text"
>>>         android:layout_gravity="**center"
>>>         android:textSize="20sp"/>
>>>     <Button
>>>         android:id="@+id/alltid_**button"
>>>         android:layout_width="265dp"
>>>         android:layout_height="wrap_**content"
>>>         android:text="@string/alltid_**text"
>>>         android:layout_gravity="**center"
>>>         android:textSize="20sp"/>
>>> <Button
>>>     android:id="@+id/aboutdev_**button"
>>>     android:layout_width="265dp"
>>>     android:layout_height="wrap_**content"
>>>     android:text="@string/**aboutdev_button"
>>>     android:layout_gravity="**center"
>>>     android:textSize="20sp"/>
>>>  </LinearLayout>
>>> </LinearLayout>
>>>
>>>
>>> Please tell me if i need anything.
>>>
>>> Den onsdag den 13. juni 2012 01.52.28 UTC+2 skrev cellurl:
>>>
>>>> Get Jetboy working first.
>>>> http://www.udemy.com/write-**and**-publish-an-app-for-your-**andro**
>>>> id-smartphone/<http://www.udemy.com/write-and-publish-an-app-for-your-android-smartphone/>
>>>> It will teach you a lot and only take 1hour.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, Jun 12, 2012 at 5:50 PM, Justin Anderson <[email protected]
>>>> > wrote:
>>>>
>>>>> Without seeing your code there is no way of knowing...
>>>>>
>>>>> Thanks,
>>>>> Justin Anderson
>>>>> MagouyaWare Developer
>>>>> http://sites.google.com/site/**m**agouyaware<http://sites.google.com/site/magouyaware>
>>>>>
>>>>>
>>>>> On Thu, Jun 7, 2012 at 1:21 PM, Lars <[email protected]> wrote:
>>>>>
>>>>>> Hello
>>>>>> I am new at this site and new at developing.
>>>>>> The first activity in my application has 5 buttons, every one of them
>>>>>> should(at som point when I get it done) lead to a web page using the
>>>>>> "webview" wigdet. Eclipse does'nt show any errors or mistakes in the code
>>>>>> ANYWHERE.
>>>>>>
>>>>>> BUT, when I try to run the app on my phone it only shows my
>>>>>> background color and the applications name.
>>>>>>
>>>>>> This is what Eclipse shows (picture is taken with my phone) in
>>>>>> main.xml
>>>>>>
>>>>>> <https://lh6.googleusercontent.com/-Eh4Mstm6RTI/T9D-o7D2CsI/AAAAAAAAEdo/mNDvt-qH0k8/s1600/IMG_20120607_211404.jpg>
>>>>>> This is what my phone shows: as you can see theres something wrong.
>>>>>> but what? please help me. Thanks, Lars.
>>>>>>
>>>>>> <https://lh6.googleusercontent.com/-hF-KuNJLMk8/T9D9_s8LeXI/AAAAAAAAEdY/_iry-jMFNv4/s1600/Screenshot_2012-06-07-19-05-04.png>
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Android Developers" group.
>>>>>> To post to this group, send email to android-developers@**googlegroup
>>>>>> **s.com <[email protected]>
>>>>>> To unsubscribe from this group, send email to
>>>>>> android-developers+**unsubscribe**@googlegroups.com<android-developers%[email protected]>
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/**group**/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en>
>>>>>
>>>>>
>>>>>  --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Android Developers" group.
>>>>> To post to this group, send email to android-developers@**googlegroup*
>>>>> *s.com <[email protected]>
>>>>> To unsubscribe from this group, send email to
>>>>> android-developers+**unsubscribe**@googlegroups.com<android-developers%[email protected]>
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/**group**/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en>
>>>>
>>>>
>>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to android-developers@**
>>> googlegroups.com <[email protected]>
>>> To unsubscribe from this group, send email to
>>> android-developers+**[email protected]<android-developers%[email protected]>
>>> For more options, visit this group at
>>> http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en>
>>>
>>
>>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to