List of usage examples for android.content Intent getIntExtra
public int getIntExtra(String name, int defaultValue)
From source file:br.com.virtz.www.cfcmob.MessageReplyReceiver.java
@Override public void onReceive(Context context, Intent intent) { if (MyMessagingService.REPLY_ACTION.equals(intent.getAction())) { int conversationId = intent.getIntExtra(MyMessagingService.CONVERSATION_ID, -1); CharSequence reply = getMessageText(intent); Log.d(TAG, "Got reply (" + reply + ") for ConversationId " + conversationId); }//from w w w. j a v a2 s . co m }
From source file:br.pro.menotti.opus.pt.DisplayPoints.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent intent = getIntent(); final int book = intent.getIntExtra("book", 0); int chapter = intent.getIntExtra("chapter", 0); final String search_key = intent.getStringExtra("search_key"); final boolean favorites = intent.getBooleanExtra("favorites", false); db = new SQLiteHelper(this); db.openDataBase();/*from w w w . jav a2 s .c o m*/ // final String book_name = db.getBook(book).toString(); ListView lv = (ListView) findViewById(android.R.id.list); lv.setFastScrollEnabled(true); if (favorites) { setTitle(getString(R.string.display_favorites)); List<BookPoint> points = new ArrayList<BookPoint>(); points = db.getFavoritePoints(); lv.setAdapter(new ArrayAdapter<BookPoint>(this, android.R.layout.simple_list_item_1, points)); } else if (search_key != null) { setTitle(getString(R.string.display_search) + ": " + search_key); List<BookPoint> points = new ArrayList<BookPoint>(); points = db.getPoints(search_key); lv.setAdapter(new ArrayAdapter<BookPoint>(this, android.R.layout.simple_list_item_1, points)); } else { setTitle(db.getBook(book) + ": " + db.getChapter(book, chapter)); List<BookPoint> points = new ArrayList<BookPoint>(); points = db.getBookPoints(book, chapter); lv.setAdapter(new ArrayAdapter<BookPoint>(this, android.R.layout.simple_list_item_1, points)); } lv.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { db = new SQLiteHelper(getBaseContext()); db.openDataBase(); BookPoint bp = (BookPoint) parent.getItemAtPosition(position); DialogFragment newFragment = new DialogPoint(bp, favorites); newFragment.show(getSupportFragmentManager(), bp.toString()); db.close(); return true; } }); db.close(); }
From source file:br.pro.menotti.opus.pt.DisplayChapters.java
@Override protected void onCreate(Bundle savedInstanceState) { SQLiteHelper db;//w w w .ja v a 2 s . c om super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent intent = getIntent(); book = intent.getIntExtra("book", 0); db = new SQLiteHelper(this); db.openDataBase(); List<Chapter> chapters = new ArrayList<Chapter>(); chapters = db.getChapters(book); setTitle(getString(R.string.display_chapters) + ": " + db.getBook(book)); db.close(); ListView lv = (ListView) findViewById(android.R.id.list); lv.setAdapter(new CustomAdapter<Chapter>(this, android.R.layout.simple_list_item_1, chapters)); Toast.makeText(getApplicationContext(), (getString(R.string.display_aleatory_point)), Toast.LENGTH_SHORT) .show(); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { showPoints(book, (int) id); } }); lv.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { SQLiteHelper db; db = new SQLiteHelper(getBaseContext()); db.openDataBase(); BookPoint bp = db.getBookPoint(book, position); DialogFragment newFragment = new DialogPoint(bp); newFragment.show(getSupportFragmentManager(), bp.toString()); db.close(); return true; } }); }
From source file:MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { Toast.makeText(this, Integer.toString(data.getIntExtra(REQUEST_RESULT, 0)), Toast.LENGTH_LONG).show(); }/*from w w w . j a va2 s . co m*/ }
From source file:com.insthub.O2OMobile.Activity.G0_ReportActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.g0_report);/*w w w . ja v a2 s . com*/ mBack = (ImageView) findViewById(R.id.top_view_back); mTitle = (TextView) findViewById(R.id.top_view_title); mComplainEdittext = (EditText) findViewById(R.id.d13_complain_edittext); mComplainButton = (Button) findViewById(R.id.d13_complain_button); Intent intent = getIntent(); mOrderId = intent.getIntExtra("orderId", 0); mUserId = intent.getIntExtra("userId", 0); mBack.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub finish(); } }); mTitle.setText(getString(R.string.complain)); mReportModel = new ReportModel(this); mReportModel.addResponseListener(this); mComplainButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String str = mComplainEdittext.getText().toString(); if (str.equals("")) { ToastView toast = new ToastView(G0_ReportActivity.this, getString(R.string.input_complain_content)); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } else { mReportModel.report(mOrderId, mUserId, str); } } }); }
From source file:com.example.activity.ShotActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.shot);// ww w. j a v a2 s.c om Intent intent = getIntent(); playerId = intent.getIntExtra(PLAYER_ID, 1); playerName = intent.getStringExtra(PLAYER_NAME); back = (ImageView) findViewById(R.id.topview_back); back.setVisibility(View.VISIBLE); back.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub finish(); } }); title = (TextView) findViewById(R.id.topview_title); title.setText(playerName + "Shot"); xlistView = (XListView) findViewById(R.id.shot_listview); xlistView.setXListViewListener(this, 0); xlistView.setPullLoadEnable(true); xlistView.setRefreshTime(); shotModel = new ShotModel(this); shotModel.addResponseListener(this); shotModel.getProfileShotList(playerId); }
From source file:com.example.activity.LikeShotListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.shot);// ww w. ja v a2s . c o m Intent intent = getIntent(); playerId = intent.getIntExtra(PLAYER_ID, 1); playerName = intent.getStringExtra(PLAYER_NAME); back = (ImageView) findViewById(R.id.topview_back); back.setVisibility(View.VISIBLE); back.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub finish(); } }); title = (TextView) findViewById(R.id.topview_title); title.setText(playerName + "Shot"); xlistView = (XListView) findViewById(R.id.shot_listview); xlistView.setXListViewListener(this, 0); xlistView.setPullLoadEnable(true); xlistView.setRefreshTime(); likeShotModel = new LikeShotModel(this); likeShotModel.addResponseListener(this); likeShotModel.getLikeShotList(playerId); }
From source file:cl.chihau.holaauto.MessageReadReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "onReceive called"); if (MyMessagingService.READ_ACTION.equals(intent.getAction())) { int conversationId = intent.getIntExtra(MyMessagingService.CONVERSATION_ID, -1); if (conversationId != -1) { Log.d(TAG, "Conversation " + conversationId + " was read"); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); notificationManager.cancel(conversationId); }//from w ww .ja v a 2 s . c om } }
From source file:com.commonsware.android.lollipopnotify.AlarmReceiver.java
@Override public void onReceive(Context ctxt, Intent i) { NotificationManagerCompat mgr = NotificationManagerCompat.from(ctxt); switch (i.getIntExtra(EXTRA_TYPE, -1)) { case 0://from ww w. j a v a 2 s .com notifyPrivate(ctxt, mgr); break; case 1: notifyPublic(ctxt, mgr); break; case 2: notifySecret(ctxt, mgr); break; case 3: notifyHeadsUp(ctxt, mgr); break; } }
From source file:de.bolz.android.taglocate.ui.TagEditActivity.java
/** * Standard onCreate method. Gets the latitude and longitude int's from the * Intent./*from w w w. j a v a 2 s . c o m*/ */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent i = getIntent(); this.latInt = i.getIntExtra(getString(R.string.center_lat), EditDispatchActivity.COORDINATENOTSET); this.lonInt = i.getIntExtra(getString(R.string.center_lon), EditDispatchActivity.COORDINATENOTSET); }