| |||||||
Das Thema "Rss" befindet sich unter Android App Entwicklung auf Android-Hilfe.de.
|
| | Themen-Optionen | Ansicht |
| | #2 (permalink) |
| Android Guru Registriert seit: 09.05.2009
Beiträge: 2.389
Abgegebene Danke: 36
Erhielt 307 Danke für 289 Beiträge
| glaub ich dir nicht zu rss gibts genug im netz
__________________ App Entwicklung Latest apps: Media Streamer BETA | DailyCash | MoneyManager ( PRO | HD ) |
| | |
| | #3 (permalink) |
| Neuer Benutzer Registriert seit: 16.11.2011
Beiträge: 15
Abgegebene Danke: 1
Erhielt 0 Danke für 0 Beiträge
|
ALso hab einige Tutoria gelesen und trozdem nix gebacken gekriegt. Zur zeit sehen meine COde so aus: main.xml Code: <?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> Code: <?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> RSSActivity.java Code: 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();
}
} Code: 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);
}
} Code: <?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> |
| | |
| | #4 (permalink) |
| Android Guru Registriert seit: 09.05.2009
Beiträge: 2.389
Abgegebene Danke: 36
Erhielt 307 Danke für 289 Beiträge
|
naja du kannst nicht erwarten, dass sich jemand deinen kompletten code durchliest. was genau geht denn nicht? markier doch die entsprechenden stellen. dann ist es auch wahrscheinlicher, dass du hilfe bekommst
__________________ App Entwicklung Latest apps: Media Streamer BETA | DailyCash | MoneyManager ( PRO | HD ) |
| | |
![]() |
|
| Themen-Optionen | |
| Ansicht | |
| |
| ||||
| Thema | Autor | Forum | Antworten | Letzter Beitrag |
| RSS Reader | Touhy | Informationsdienste | 9 | 01.12.2011 18:02 |
| rss | Veit78 | Huawei S7 Forum | 2 | 17.01.2011 09:33 |
| Rss | habela31 | Motorola Milestone Forum | 3 | 21.05.2010 09:09 |
| Freshface RSS Reader - heise geht nicht? Alternatives RSS-Widget? | Compufreak | Android Themes | 2 | 19.08.2009 15:39 |
| Rss! | ROMOPAT | Anregungen | 10 | 04.02.2009 11:55 |