![Jaiel](/data/avatars/s/353/353209.jpg,q1569149551.pagespeed.ce._qDCe2uJo2.jpg)
Jaiel
Dauer-User
- 235
hab ich wohl überlesen...wie gesagt wenn die R datei nciht gebildet wird dann wird es wohl in einem XML file probleme geben...das ist zu 80% immer der Fall
Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
[SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="[URL]http://schemas.android.com/apk/res/android[/URL]"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<!-- Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="[URL="http://www.javacodegeeks.com"]www.javacodegeeks.com[/URL] ok"
/-->
</LinearLayout>
[/COLOR][/SIZE][/COLOR][/SIZE]
package com.example.a2;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.view.View;
import android.view.View.OnClickListener; public class MainActivity extends Activity
{
private Button button2;
private Button button3;
@Override public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
addListenerOnButton();
}
public void addListenerOnButton()
{
// Select a specific button to bundle it with the action you want
// button = (Button) findViewById(R.id.button1);
LinearLayout ll = (LinearLayout)findViewById(R.id.linearLayout1);
LayoutParams lp = new LayoutParams( LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
button2 = new Button(this);
button2.setText("B2");
ll.addView(button2, lp);
button3 = new Button(this);
button3.setText("B3 x");
ll.addView(button3, lp);
for (int li=0; li<4; li++)
{
Button l_button = new Button(this);
String ls= ""+li;
l_button.setText("B "+ls);
ll.addView(l_button, lp);
l_button.setOnClickListener
( new OnClickListener()
{ @Override public void onClick(View view)
{ Intent openBrowser = new Intent( Intent.ACTION_VIEW,
Uri.parse("[URL]http://www.javacodegeeks.com[/URL]")
);
startActivity(openBrowser);
}
}
);
}
/* button.setOnClickListener
( new OnClickListener()
{ @Override public void onClick(View view)
{ Intent openBrowser = new Intent(
Intent.ACTION_VIEW, Uri.parse("[URL="http://www.javacodegeeks.com"]Java Programming, Learn Java Online with the Java Code Geeks | Java developers resource center - Java, Scala, Groovy, Android[/URL]")
);
startActivity(openBrowser);
}
}
);*/
}
} // public class MainActivity