K
Kapvoys344
Neues Mitglied
- 0
Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion erfordert derzeit den Zugriff auf die Seite über den integrierten Safari-Browser.
Kapvoys344 schrieb:nur leider finde keine gute Tutoria.
:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Enter RSS URL:"
/>
<EditText
android:id="@+id/rssURL"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:text="http://www.rss-nachrichten.de/service/rss-feeds.xml"
/>
<Button
android:id="@+id/fetchRss"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dip"
android:text="Fetch Rss" />
<ListView
android:id="@+id/rssListView"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TextView
android:id="@+id/titleTextView"
android:text="Title:"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="13sp"
android:autoLink="all"
/>
<TextView
android:id="@+id/contentTextView"
android:text="Content:"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="13sp"
android:autoLink="all"
/>
</LinearLayout>
package rembo.network.urss;
import android.app.Activity;
import android.os.Bundle;
import android.widget.*;
import java.util.*;
import android.view.View;
import android.content.*;
public class RSSactivity extends Activity {
public static RssItem selectedRssItem = null;
String feedUrl = "";
ListView rssListView = null;
ArrayList<RssItem> rssItems = new ArrayList<RssItem>();
ArrayAdapter<RssItem> aa = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// get textview from our layout.xml
final TextView rssURLTV = (TextView) findViewById(R.id.rssURL);
// get button from layout.xml
Button fetchRss = (Button) findViewById(R.id.fetchRss);
// define the action that will be executed when the button is clicked.
fetchRss.setOnClickListener(new View.OnClickListener() {
//@Override
public void onClick(View v) {
feedUrl = rssURLTV.getText().toString();
//TextView TVtitle=(TextView)findViewById(R.id.label);
//CharSequence cs="fetching";
//TVtitle.setText(cs);
aa.notifyDataSetChanged();
refressRssList();
//cs="Feed:";
//TVtitle.setText(cs);
}
});
// get the listview from layout.xml
rssListView = (ListView) findViewById(R.id.rssListView);
// here we specify what to execute when individual list items clicked
rssListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
//@Override
public void onItemClick(AdapterView<?> av, View view, int index,
long arg3) {
selectedRssItem = rssItems.get(index);
// we call the other activity that shows a single rss item in
// one page
Intent intent = new Intent(
"rembo.network.urss.displayRssItem");
startActivity(intent);
}
});
//adapters are used to populate list. they take a collection,
//a view (in our example R.layout.list_item
aa = new ArrayAdapter<RssItem>(this, R.layout.list_item, rssItems);
//here we bind array adapter to the list
rssListView.setAdapter(aa);
feedUrl = rssURLTV.getText().toString();
refressRssList();
}
private void refressRssList() {
ArrayList<RssItem> newItems = RssItem.getRssItems(feedUrl);
rssItems.clear();
rssItems.addAll(newItems);
//TextView TVtitle=(TextView)findViewById(R.id.label);
//CharSequence cs="0";
//if(newItems.size()>0) cs="is 1";
//if(newItems.size()>5) cs="is 5";
///TVtitle.setText(cs);
aa.notifyDataSetChanged();
}
}
import android.app.Activity;
import android.os.Bundle;
import android.widget.*;
import java.text.*;
public class RssItemDisplayer extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.rss_item_displayer);
RssItem selectedRssItem = RSSactivity.selectedRssItem;
//Bundle extras = getIntent().getExtras();
TextView titleTv = (TextView)findViewById(R.id.titleTextView);
TextView contentTv = (TextView)findViewById(R.id.contentTextView);
String title = "";
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd - hh:mm:ss");
title = "\n" + selectedRssItem.getTitle() + " ( "
+ sdf.format(selectedRssItem.getPubDate()) + " )\n\n";
String content = "";
content += selectedRssItem.getDescription() + "\n"
+ selectedRssItem.getLink();
titleTv.setText(title);
contentTv.setText(content);
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="rembo.network.urss"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".URSSActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>