This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Persistence in the Service | |
Gson gson = new Gson(); | |
Type type = new TypeToken<List<RssItem>>() {}.getType(); | |
String json = gson.toJson(list, type); | |
try (FileOutputStream openFileOutput = | |
openFileOutput(RssApplication.RSS_FILE, Context.MODE_PRIVATE);) { | |
openFileOutput.write(json.getBytes()); | |
} catch (Exception ex){ | |
// do nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.android.rssreader; | |
import android.app.IntentService; | |
import android.app.Notification; | |
import android.app.NotificationManager; | |
import android.content.Intent; | |
import com.example.android.rssfeedlibrary.RssFeedProvider; | |
import com.example.android.rssfeedlibrary.RssItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.android.rssreader; | |
import android.app.Activity; | |
import android.app.Fragment; | |
import android.app.FragmentTransaction; | |
import android.os.Bundle; | |
import android.widget.FrameLayout; | |
public class RssfeedActivity extends Activity implements | |
MyListFragment.OnItemSelectedListener { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.e4.rcp.todo.addons; | |
import java.util.List; | |
import javax.inject.Inject; | |
import org.eclipse.e4.core.di.annotations.Optional; | |
import org.eclipse.e4.core.di.extensions.EventTopic; | |
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; | |
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspectiveStack; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.eclipse.swt.*; | |
import org.eclipse.swt.layout.*; | |
import org.eclipse.swt.widgets.*; | |
public class Main { | |
public static void main (String [] args) { | |
Display display = new Display (); | |
Shell shell = new Shell (display); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.vogella.android.multitouch; | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Paint; | |
import android.graphics.PointF; | |
import android.util.AttributeSet; | |
import android.util.SparseArray; | |
import android.view.MotionEvent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BroadcastReceiver updateReceiver = new BroadcastReceiver() { | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
updateListContent(); | |
} | |
}; | |
IntentFilter f = new IntentFilter("ESGIBTNEUEDATEN"); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<RssItem> list = RssFeedProvider.parse(url); | |
RssApplication.list.clear(); | |
RssApplication.list.addAll(list); | |
Gson gson = new Gson(); | |
Type type = new TypeToken<List<RssItem>>() {}.getType(); | |
String json = gson.toJson(list, type); | |
try (FileOutputStream openFileOutput = getActivity().openFileOutput(RssApplication.RSS_FILE, Context.MODE_PRIVATE);) | |
{ | |
openFileOutput.write(json.getBytes()); | |
} catch (Exception ex){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onCreateOptionsMenu(Menu menu) { | |
Toolbar tb = (Toolbar) findViewById(R.id.toolbar); | |
tb.inflateMenu(R.menu.mainmenu); | |
tb.setOnMenuItemClickListener( | |
new Toolbar.OnMenuItemClickListener() { | |
@Override | |
public boolean onMenuItemClick(MenuItem item) { | |
return onOptionsItemSelected(item); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.android.rssreader; | |
import android.app.Activity; | |
import android.app.Fragment; | |
import android.app.FragmentTransaction; | |
import android.os.Bundle; | |
public class RssfeedActivity extends Activity implements | |
MyListFragment.OnItemSelectedListener { |