Java 类android.content.Intent 实例源码
项目:MobileMedia
文件:VitamioVideoPlayerActivity.java
private void startSystemPlayer() {
Intent intent = null;
if (mMediaItems != null) {
SerializableList<MediaItem> list = new SerializableList<>();
list.setList(mMediaItems);
intent = SystemVideoPlayerActivity.newIntent(this, list, mCurrentPlayIndex);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
} else if (mUri != null) {
intent = SystemVideoPlayerActivity.newIntent(this, mUri.toString());
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
intent.setData(mUri);
} else if (mPlayUrl != null) {
intent = SystemVideoPlayerActivity.newIntent(this, mPlayUrl);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);
}
startActivity(intent);
finish();
}
项目:sealtalk-android-master
文件:AudioPlugin.java
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != Activity.RESULT_OK) {
return;
}
Intent intent = new Intent(RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIAUDIO);
ArrayList<String> userIds = data.getStringArrayListExtra("invited");
userIds.add(RongIMClient.getInstance().getCurrentUserId());
intent.putExtra("conversationType", conversationType.getName().toLowerCase());
intent.putExtra("targetId", targetId);
intent.putExtra("callAction", RongCallAction.ACTION_OUTGOING_CALL.getName());
intent.putStringArrayListExtra("invitedUsers", userIds);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setPackage(context.getPackageName());
context.getApplicationContext().startActivity(intent);
}
项目:MeetMusic
文件:LastMyloveActivity.java
private void update(View swipeView, int position,MusicInfo musicInfo,boolean isDelete){
if (isDelete){
final int curId = musicInfo.getId();
final int musicId = MyMusicUtil.getIntShared(Constant.KEY_ID);
//从列表移除
if (label.equals(Constant.LABEL_LAST)){
dbManager.removeMusic(musicInfo.getId(),Constant.ACTIVITY_RECENTPLAY);
}else if (label.equals(Constant.ACTIVITY_MYLOVE)){
dbManager.removeMusic(musicInfo.getId(),Constant.LIST_LASTPLAY);
}
if (curId == musicId) {
//移除的是当前播放的音乐
Intent intent = new Intent(MusicPlayerService.PLAYER_MANAGER_ACTION);
intent.putExtra(Constant.COMMAND, Constant.COMMAND_STOP);
sendBroadcast(intent);
}
recyclerViewAdapter.notifyItemRemoved(position);//推荐用这个
updateView();
}else {
}
//如果删除时,不使用mAdapter.notifyItemRemoved(pos),则删除没有动画效果,
//且如果想让侧滑菜单同时关闭,需要同时调用 ((CstSwipeDelMenu) holder.itemView).quickClose();
((SwipeMenuLayout) swipeView).quickClose();
}
项目:odoo-work
文件:WizardAddTeamMembers.java
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_skip:
startActivity(new Intent(this, HomeActivity.class));
finish();
break;
case R.id.editAddMember:
Intent intent = new Intent(this, SelectMembers.class);
startActivityForResult(intent, 1);
break;
case R.id.btn_continue:
addMemberIds();
break;
}
}
项目:Grossery-list
文件:MainActivity.java
public void WhatsApp(View view, String TextToUse) {
PackageManager pm=getPackageManager();
try {
Intent waIntent = new Intent(Intent.ACTION_SEND);
waIntent.setType("text/plain");
PackageInfo info=pm.getPackageInfo("com.whatsapp", PackageManager.GET_META_DATA);
//Check if package exists or not. If not then code
//in catch block will be called
waIntent.setPackage("com.whatsapp");
waIntent.putExtra(Intent.EXTRA_TEXT, TextToUse);
startActivity(Intent.createChooser(waIntent, "Share with"));
} catch (PackageManager.NameNotFoundException e) {
Toast.makeText(this, "WhatsApp not Installed", Toast.LENGTH_SHORT).show();
}
}
项目:stynico
文件:lua_web.java
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
if (url.startsWith("http:") || url.startsWith("https:"))
{
return false;
}
else if (url.startsWith(WebView.SCHEME_TEL) ||
url.startsWith("sms:") ||
url.startsWith(WebView.SCHEME_MAILTO) ||
url.startsWith(WebView.SCHEME_GEO) ||
url.startsWith("maps:"))
{
try
{
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
}
catch (android.content.ActivityNotFoundException e)
{
}
}
return true;
}
项目:ProgressManager
文件:a.java
private void dispatchRequestPermissionsResultToFragment(int requestCode, Intent data,
Fragment fragment) {
// If the package installer crashed we may have not data - best effort.
String[] permissions = (data != null) ? data.getStringArrayExtra(
PackageManager.EXTRA_REQUEST_PERMISSIONS_NAMES) : new String[0];
final int[] grantResults = (data != null) ? data.getIntArrayExtra(
PackageManager.EXTRA_REQUEST_PERMISSIONS_RESULTS) : new int[0];
fragment.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
项目:Simpler
文件:FileUtils.java
/**
* 调用系统方式打开文件.
*
* @param context 上下文
* @param file 文件
*/
public static void openFile(Context context, File file) {
try {
// 调用系统程序打开文件.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setDataAndType(Uri.fromFile(file), MimeTypeMap.getSingleton()
.getMimeTypeFromExtension(
MimeTypeMap
.getFileExtensionFromUrl(
file.getPath())));
context.startActivity(intent);
} catch (Exception ex) {
ex.printStackTrace();
}
}
项目:NUI_Project
文件:VoiceActivity.java
/**
* Showing google speech input dialog
* */
private void promptSpeechInput() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());
intent.putExtra(RecognizerIntent.EXTRA_PROMPT,
getString(R.string.speech_prompt));
try {
startActivityForResult(intent, REQ_CODE_SPEECH_INPUT);
} catch (ActivityNotFoundException a) {
Toast.makeText(getApplicationContext(),
getString(R.string.speech_not_supported),
Toast.LENGTH_SHORT).show();
}
}
项目:Hotspot-master-devp
文件:LocalVideoProAcitvity.java
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == EXTRA_TV_INFO){
// 可能会发生网络切换所以这里要重新设置视频播放地址
String asseturl = mModelVideo.getAsseturl();
if(!TextUtils.isEmpty(asseturl)&&asseturl.contains("0/")) {
int index = asseturl.indexOf("0/");
asseturl = NetWorkUtil.getLocalUrl(LocalVideoProAcitvity.this)+asseturl.substring(index+1,asseturl.length());
mModelVideo.setAsseturl(asseturl);
}
initBindcodeResult();
// if(data!=null) {
// TvBoxInfo boxInfo = (TvBoxInfo) data.getSerializableExtra(EXRA_TV_BOX);
// mBindTvPresenter.handleBindCodeResult(boxInfo);
// }
}else if (resultCode == SCAN_QR) {
if(data!=null) {
String scanResult = data.getStringExtra("scan_result");
mBindTvPresenter.handleQrcodeResult(scanResult);
LogUtils.d("扫描结果:" + scanResult);
}
// showToast(scanResult);
}
}
项目:react-native-forward-calls
文件:RNForwardCallsModule.java
@ReactMethod
public void allConditionalForwarding (String phoneNumber) {
String uri = "tel:*002*" + Uri.encode(phoneNumber+"#");
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse(uri));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.reactContext.startActivity(intent);
}
项目:GitHub
文件:HomeRecycleAdapter.java
public void setData(final List<ResultBean.HotInfoBean> data) {
HotGridViewAdapter adapter = new HotGridViewAdapter(mContext, data);
gv_hot.setAdapter(adapter);
//点击事件
gv_hot.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// Toast.makeText(mContext, "position:" + position, Toast.LENGTH_SHORT).show();
String cover_price = data.get(position).getCover_price();
String name = data.get(position).getName();
String figure = data.get(position).getFigure();
String product_id = data.get(position).getProduct_id();
GoodsBean goodsBean = new GoodsBean(name, cover_price, figure, product_id);
Intent intent = new Intent(mContext, GoodsInfoActivity.class);
intent.putExtra(GOODS_BEAN, goodsBean);
mContext.startActivity(intent);
}
});
}
项目:XERUNG
文件:GroupSettings.java
private void selectImage() {
final CharSequence[] items = { "Take Photo", "Choose from Gallery","Cancel" };
AlertDialog.Builder builder = new AlertDialog.Builder(GroupSettings.this);
builder.setTitle("Select Photo");
builder.setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int item) {
if (items[item].equals("Take Photo")) {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(takePictureIntent,REQUEST_IMAGE_CAPTURE);
}
} else if (items[item].equals("Choose from Gallery")) {
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, SELECT_PHOTO);
} else if (items[item].equals("Cancel")) {
dialog.dismiss();
}
}
});
builder.show();
}
项目:FamilyBond
文件:NotificationUtil.java
public static void create(Context context, int id, Intent intent, int smallIcon, String contentTitle, String contentText) {
NotificationManager manager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
PendingIntent p = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
.setContentIntent(p)
.setContentTitle(contentTitle)
.setContentText(contentText)
.setSmallIcon(smallIcon)
.setAutoCancel(true);
Notification n = builder.build();
manager.notify(id, n);
}
项目:actions
文件:SendMail.java
public void sending() {
Log.d(TAG, "Sending");
if (!validate()) {
onSendFailed();
return;
}
_sendButton.setEnabled(false);
final ProgressDialog progressDialog = new ProgressDialog(SendMail.this,
R.style.AppTheme_Dark_Dialog);
progressDialog.setIndeterminate(true);
progressDialog.setMessage("И-мэйл илгээж байна...");
progressDialog.show();
String from = _fromText.getText().toString();
String to = _toText.getText().toString();
String subject = _subjectText.getText().toString();
String composeEmail = _composeEmailText.getText().toString();
Intent sendingMailIntent = new Intent(Intent.ACTION_SEND);
sendingMailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { to });
sendingMailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
sendingMailIntent.putExtra(Intent.EXTRA_TEXT,composeEmail);
sendingMailIntent.setType("message/rfc822");
startActivity(sendingMailIntent);
new android.os.Handler().postDelayed(
new Runnable() {
public void run() {
// On complete call either onSignupSuccess or onSignupFailed
// depending on success
onSendSuccess();
// onSignupFailed();
progressDialog.dismiss();
}
}, 3000);
}
项目:Monolith
文件:MonolithWidget.java
static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
int appWidgetId) {
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.monolith_widget);
// Intent to launch MainActivity
final Intent onItemClick = new Intent(context, MonolithWidget.class);
onItemClick.setAction(ACTION_WIDGET_CLICK);
if (intent != null) {
onItemClick.setData(intent.getData());
Log.e("Content not null", "updateAppWidget: " + intent.getData());
}
PendingIntent onClickPendingIntent = PendingIntent
.getBroadcast(context, 0, onItemClick,
PendingIntent.FLAG_UPDATE_CURRENT);
views.setPendingIntentTemplate(R.id.widget_list,
onClickPendingIntent);
views.setRemoteAdapter(R.id.widget_list,
new Intent(context, WidgetService.class));
views.setEmptyView(R.id.widget_list, R.id.widget_empty);
// Instruct the widget manager to update the widget
appWidgetManager.updateAppWidget(appWidgetId, views);
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.widget_list);
}
项目:Linux-notifier-Android
文件:NotificationReceiver.java
@Override
public void onNotificationPosted (StatusBarNotification sbn)
{
Intent intent = new Intent(String.valueOf(R.string.app_name));
intent.setClass(this, NotificationBroadcastReceiver.class);
intent.setAction(actions.NOTIFICATION_RECEIVED.toString());
try
{
PackageManager packageManager = getApplicationContext().getPackageManager();
ApplicationInfo applicationInfo;
applicationInfo = packageManager.getApplicationInfo(sbn.getPackageName(), 0);
intent.putExtra("app name", packageManager.getApplicationLabel(applicationInfo));
}
catch(PackageManager.NameNotFoundException e)
{
intent.putExtra("app name", "unknown application");
}
intent.putExtra("title", sbn.getNotification().extras.getString("android.title"));
intent.putExtra("data", sbn.getNotification().extras.getString("android.text"));
sendBroadcast(intent);
}
项目:RecyclerViewPreferences
文件:BasePreferenceActivity.java
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == Config.RC_PICK_IMAGES && resultCode == RESULT_OK && data != null) {
ArrayList<Image> images = data.getParcelableArrayListExtra(Config.EXTRA_IMAGES);
if (images.size() == 1) {
// not beutiful solution: instead of adding the id to the dialog event, which would need to adjustments to it,
// we just take the single image picker id we know of
int settingsId = SettingsDefinitions.SETT_ID_IMAGE_PICKER.get();
boolean global = true; // we only have a global image picker in use in this demo
CustomImageSetting.Data newData = new CustomImageSetting.Data(Uri.fromFile(new File(images.get(0).getPath())));
SettingsManager.get().dispatchCustomDialogEvent(
settingsId,
this,
newData,
global
);
}
}
super.onActivityResult(requestCode, resultCode, data); // THIS METHOD SHOULD BE HERE so that ImagePicker works with fragment
}
项目:Odyssey2017
文件:LoginActivity.java
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
Toast.makeText(getApplicationContext(),s,Toast.LENGTH_LONG).show();
progressBar.setVisibility(View.GONE);
if (s.equalsIgnoreCase("Success"))
{
try {
snappyDB.put("Email", etemail.getText().toString());
snappyDB.put("Password", etpassword.getText().toString());
snappyDB.close();
}
catch (SnappydbException e){e.printStackTrace();}
Intent intent=new Intent(LoginActivity.this,HomeActivity.class);
startActivity(intent);
finish();
}
}
项目:FakeWeather
文件:GirlService.java
@Override
protected void onHandleIntent(Intent intent) {
String from = intent.getStringExtra(KEY_EXTRA_GIRL_FROM);
List<Girl> girls = (List<Girl>) intent.getSerializableExtra(KEY_EXTRA_GIRL_LIST);
for (final Girl girl : girls) {
Bitmap bitmap = null;
try {
bitmap = Glide.with(GirlService.this)
.load(girl.getUrl())
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
.get();
} catch (Exception e) {
e.printStackTrace();
}
if (bitmap != null) {
girl.setHeight(bitmap.getHeight());
girl.setWidth(bitmap.getWidth());
}
EventBus.getDefault().post(new GirlsComingEvent(from, girl));
}
}
项目:Moodr
文件:ViewFriendMoodActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.view_mood);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
new NavDrawerSetup(this, toolbar).setupNav();
Intent intent = getIntent();
Mood mood = (Mood) intent.getSerializableExtra("mood");
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction ft = manager.beginTransaction();
ft.add(R.id.mood_content, ViewMoodFragment.newInstance(mood));
ft.commit();
}
项目:item-reaper
文件:EditItemFragment.java
@Override
public void openCamera(ImageFile imageFile) {
mImageFile = imageFile;
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (intent.resolveActivity(getContext().getPackageManager()) != null) {
intent.putExtra(MediaStore.EXTRA_OUTPUT, mImageFile.getUri(getContext()));
startActivityForResult(intent, REQUEST_CODE_IMAGE_CAPTURE);
}
}
项目:GoMeet
文件:PostActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
stopService(new Intent(this, LocationMonitoringService.class));
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
this.finish(); // Back button
return true;
}
return super.onOptionsItemSelected(item);
}
项目:JavaIsFun
文件:OQueEJava8.java
@Override
public void onBackPressed() {
Intent intent = new Intent(this, OQueEJava7.class);
startActivity(intent);
overridePendingTransition( R.anim.rigth_in, R.anim.rigth_out);
}
项目:android-apkbox
文件:HookActivityInstrumentationHnadler.java
protected ActivityResult proxyExecStartActivity(Context who, IBinder contextThread, IBinder token, Activity target,
Intent intent, int requestCode, Bundle options) throws Exception {
try {
Intent targetIntent = HookActivity_Intent.modify(target, intent);
if (targetIntent == null) {
targetIntent = intent;
}
ApkMethod method = new ApkMethod(Instrumentation.class, mInstrumentation, "execStartActivity", Context.class, IBinder.class, IBinder.class, Activity.class, Intent.class, int.class, Bundle.class);
return method.invoke(who, contextThread, token, target, targetIntent, requestCode, options);
} catch (Exception e) {
throw e;
}
}
项目:ProgressManager
文件:a.java
/**
* @hide Implement to provide correct calling token.
*/
public void startActivityForResultAsUser(Intent intent, int requestCode,
@Nullable Bundle options, UserHandle user) {
if (mParent != null) {
throw new RuntimeException("Can't be called from a child");
}
options = transferSpringboardActivityOptions(options);
Instrumentation.ActivityResult ar = mInstrumentation.execStartActivity(
this, mMainThread.getApplicationThread(), mToken, this, intent, requestCode,
options, user);
if (ar != null) {
mMainThread.sendActivityResult(
mToken, mEmbeddedID, requestCode, ar.getResultCode(), ar.getResultData());
}
if (requestCode >= 0) {
// If this start is requesting a result, we can avoid making
// the activity visible until the result is received. Setting
// this code during onCreate(Bundle savedInstanceState) or onResume() will keep the
// activity hidden during this time, to avoid flickering.
// This can only be done when a result is requested because
// that guarantees we will get information back when the
// activity is finished, no matter what happens to it.
mStartedActivity = true;
}
cancelInputsAndStartExitTransition(options);
}
项目:BrotherWeather
文件:MainActivity.java
@OnClick({ R.id.ivCities, R.id.ivSetting }) public void onClick(View view) {
switch (view.getId()) {
case R.id.ivCities:
startActivity(new Intent(MainActivity.this, CityListActivity.class));
break;
case R.id.ivSetting:
break;
}
}
项目:ascii_generate
文件:ShareUtil.java
public static void shareText(String text, Context context) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, text);
intent.setType("text/plain");
context.startActivity(intent);
}
项目:container
文件:VActivityManagerService.java
private void handleStaticBroadcastAsUser(int vuid, ActivityInfo info, Intent intent,
PendingResultData result) {
synchronized (this) {
ProcessRecord r = findProcessLocked(info.processName, vuid);
if (BROADCAST_NOT_STARTED_PKG && r == null) {
r = startProcessIfNeedLocked(info.processName, getUserId(vuid), info.packageName);
}
if (r != null && r.appThread != null) {
performScheduleReceiver(r.client, vuid, info, intent,
result);
}
}
}
项目:CC
文件:LoginProcessor.java
@Override
public boolean onActionCall(CC cc) {
//clear login user info
Global.loginUserName = null;
Context context = cc.getContext();
Intent intent = new Intent(context, LoginActivity.class);
if (!(context instanceof Activity)) {
//调用方没有设置context或app间组件跳转,context为application
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
intent.putExtra("callId", cc.getCallId());
context.startActivity(intent);
//不立即调用CC.sendCCResult,返回true
return true;
}
项目:MarkDown-Editor
文件:MainActivity.java
private String ShowInputMenu() {
final EditText inputFileName = new EditText(this);
io = new IOTools();
final String[] strContent = {""};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("输入文件名:").setView(inputFileName)
.setNegativeButton("Cancel", null);
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
strContent[0] = inputFileName.getText().toString();
boolean b = io.addMDFile(strContent[0],MainActivity.this);
if (b) {
long time = new Date().getTime();
MD_Info md_info = new MD_Info(strContent[0], time);
MDs.add(0, md_info);
ListViewAdapter adapter = new ListViewAdapter();
adapter.notifyDataSetChanged();
Intent intent = new Intent(MainActivity.this,ViewPagerActivity.class);
intent.putExtra("fileName",md_info.getName()+".md");
intent.putExtra("fileContent","");
startActivity(intent);
}else {
Toast.makeText(MainActivity.this,"该名字已存在!\n\t请换一个.",Toast.LENGTH_SHORT).show();
}
}
});
builder.show();
// InputMethodManager inputMethodManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
// inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
return strContent[0];
}
项目:ChenYan
文件:PublishAActivity.java
private void toCamera() {
photoDialog.dismiss();
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
tempFileCamera = new File(getFilePath() + ".jpg");
tempFileCameraUri = Uri.fromFile(tempFileCamera);
// 把拍好的照片保存到这个路径
intent.putExtra(MediaStore.EXTRA_OUTPUT, tempFileCameraUri);
startActivityForResult(intent, CAMERA_REQUEST);
}
项目:add_to_evernote_note
文件:NoteListFragment.java
@TaskResult
public void onNoteShared(String url) {
if (!TextUtils.isEmpty(url)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} else {
ViewUtil.showSnackbar(mListView, "URL is null");
}
}
项目:OAuth-2.0-Cookbook
文件:DashboardActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dashboard);
usernameText = (TextView) findViewById(R.id.profile_username);
emailText = (TextView) findViewById(R.id.profile_email);
tokenStore = new TokenStore(this);
if (new AuthenticationManager(this).isAuthenticated()) {
// add some fake user entries
ListView listView = (ListView) findViewById(R.id.dashboard_entries);
listView.setAdapter(new ArrayAdapter<>(
this, android.R.layout.simple_list_item_1,
new String[] {"Entry 1"}));
// button to retrieve user profile
Button profileButton = (Button) findViewById(R.id.profile_button);
profileButton.setOnClickListener(this);
} else {
Intent loginIntent = new Intent(this, MainActivity.class);
startActivity(loginIntent);
finish();
}
}
项目:ZxingForAndroid
文件:DecodeHintManager.java
public static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
Bundle extras = intent.getExtras();
if (extras == null || extras.isEmpty()) {
return null;
}
Map<DecodeHintType, Object> hints = new EnumMap<>(DecodeHintType.class);
for (DecodeHintType hintType : DecodeHintType.values()) {
if (hintType == DecodeHintType.CHARACTER_SET ||
hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
hintType == DecodeHintType.POSSIBLE_FORMATS) {
continue; // This hint is specified in another way
}
String hintName = hintType.name();
if (extras.containsKey(hintName)) {
if (hintType.getValueType().equals(Void.class)) {
// Void hints are just flags: use the constant specified by the DecodeHintType
hints.put(hintType, Boolean.TRUE);
} else {
Object hintData = extras.get(hintName);
if (hintType.getValueType().isInstance(hintData)) {
hints.put(hintType, hintData);
} else {
Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
}
}
}
}
Log.i(TAG, "Hints from the Intent: " + hints);
return hints;
}
项目:YelpQL
文件:BusinessDetailsActivity.java
@OnClick(R.id.tvWebsite)
void openRestaurantWebsite(View view) {
if (business != null) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(business.getUrl()));
startActivity(i);
}
}
项目:PhotoFactory
文件:PhotoFactory.java
/**
* 照相后返回高清原图相片
*/
private void TakePhotoUnTreated(){
mUri = UriUtils.GetFileUri(mActivity,new File(photoPath,photoName));
intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, mUri);
mActivity.startActivityForResult(intent,REQUEST_CODE);
}
项目:TK_1701
文件:PermissionManager.java
private void openSettings() {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
//Fragmentの場合はgetContext().getPackageName()
Uri uri = Uri.fromParts( "package", raderActivity.getPackageName(), null );
intent.setData( uri );
raderActivity.startActivity( intent );
}
项目:letv
文件:JarBaseFragmentActivity.java
protected void startActivityByProxy(String className) {
Intent intent = new Intent(PROXY_VIEW_ACTION);
intent.putExtra("extra.jarname", this.jarname);
intent.putExtra("extra.packagename", this.jar_packagename);
intent.putExtra("extra.class", className);
this.proxyActivity.startActivity(intent);
}
项目:RxJanDan
文件:IntentUtil.java
public static final void intentToFreshNewsPostActivity(Activity activity,FreshNewsPost freshNewsPost){
Intent intent = new Intent(activity,FreshNewsActivity.class);
intent.putExtra(EXTRA_NEWS_ID,String.valueOf(freshNewsPost.getId()));
intent.putExtra(EXTRA_NEWS_TITLE,freshNewsPost.getTitle());
String author = freshNewsPost.getAuthor().getName()+" @ "+freshNewsPost.getTags().get(0).getTitle();
intent.putExtra(EXTRA_NEWS_AUTHOR,author);
activity.startActivity(intent);
}