extras

How do I write an android JUnit test when my activity relies on extras passed through an Intent?

三世轮回 提交于 2020-01-02 00:13:29
问题 I am writing an android Junit test for a class that relies on extras passed to it through an Intent. I was able to get the class working properly, but I would still like to know how to write a unit test for such a class, as the test still fails. public class AddClassEvent extends Activity{ private String eventType; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); final String cNo = extras.getString(

Get extras in Cordova app

老子叫甜甜 提交于 2020-01-01 16:52:12
问题 We have two Android applications: one implemented using native Java and another written using Ionic. The Ionic app launches my app which is the Android app using the lampaa plugin. I could receive the extras that the Ionic app provides using the following code: String keyid = getIntent().getStringExtra("keyid"); Before I exit my app, I would like to send extras to the Ionic app. This is easily done from the Android side. How does the Ionic app know that my application has transferred control

Get extras in Cordova app

房东的猫 提交于 2020-01-01 16:52:06
问题 We have two Android applications: one implemented using native Java and another written using Ionic. The Ionic app launches my app which is the Android app using the lampaa plugin. I could receive the extras that the Ionic app provides using the following code: String keyid = getIntent().getStringExtra("keyid"); Before I exit my app, I would like to send extras to the Ionic app. This is easily done from the Android side. How does the Ionic app know that my application has transferred control

Fragment returning null from intent

给你一囗甜甜゛ 提交于 2019-12-25 04:34:36
问题 So i made a bunch of 4 buttons , put an intent to each of them . They all navigate to the same Fragment class . But their extras are different, so if button1 was clicked , Fragment would open and do a certain action , if button2 was clicked , Fragment would do another action and so on. I tried the code on normal activities and it worked , but in fragments its not working . It just returns me "Id is null" Class sending the intent public class Intennt extends ActionBarActivity { Button bt1,bt2

Android. Can't clear or replace extras

牧云@^-^@ 提交于 2019-12-24 16:35:25
问题 I lunch activity from notification. Intent notificationIntent = new Intent(context, MainActivity.class); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP ); notificationIntent.putExtra(GCM_EXTRA_ID, id); PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT); notification.setLatestEventInfo(context, title, message, intent); notification.flags |= Notification.FLAG_AUTO_CANCEL; notification

Pyomo Util Module Not Found

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 03:37:12
问题 So I asked a question a month ago. I had a really nice answer to that question. I wanted to test if the answer works right now. But I am getting ModuleNotFoundError . I did following before testing: conda install -c conda-forge pyomo conda install -c conda-forge pyomo.extras I want to run this script in my code (copy/pasted from the other question): from pyomo.util.infeasible import log_infeasible_constraints ... SolverFactory('your_solver').solve(model) ... log_infeasible_constraints(model)

Is there any way to put extras to Intent from preferences?

痴心易碎 提交于 2019-12-17 22:17:13
问题 Hi i'm launching activity from preferences screen. Activity is shared among three preferences. I wonder if i can set extras for this activity in xml <Preference android:key="action_1" android:title="@string/action_1_title" > <intent android:action="com.package.SHAREDACTION" > </intent> </Preference> i wonder if i can do something like <extras> <item android:name="" android:value=""/> </extras> All i need to do to pass an integer really. I can different actions and check action instead of

Android Intent.getStringExtra() returns null

北城余情 提交于 2019-12-17 11:17:30
问题 This is how strings are being added to Extras: Intent i = new Intent(); i.putExtra("Name", edt_name.getText()); i.putExtra("Description", edt_desc.getText()); i.putExtra("Priority", skb_prior.getProgress()); setResult(RESULT_OK, i); finish(); This is how I try to extract them in onActivityResult() : String name = data.getStringExtra("Name"); String desc = data.getStringExtra("Description"); int prior = data.getIntExtra("Priority", 50); But after the second code block name and desc are null 's

putExtras multiple putString not working

微笑、不失礼 提交于 2019-12-14 02:05:03
问题 I need to pass 2 variables from one activitiy to another activity. I have the following for the first activity: @Override public boolean onContextItemSelected(MenuItem item) { Bundle bundle=new Bundle(); switch (item.getItemId()){ case 1: bundle.putString(drinkButton, "4"); bundle.putString(drinkType, "1"); Intent myIntent1 = new Intent(this, DrinksList.class); myIntent1.putExtras(bundle); startActivityForResult(myIntent1, 0); return true; case 2: bundle.putString(drinkButton, "1"); bundle

Intent extras null on configuration change

亡梦爱人 提交于 2019-12-12 21:16:54
问题 I created a layout that displays on a SurfaceView and I can get the setDataSource by using Bundle extras = getIntent().getExtras() . Everything works fine until I try to set the landscape layout from land\layout.xml . My logcat is Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.trim()' on a null object reference at asia.sumikawa.cybereyeview.liveActivity.onCreate(liveActivity.java:65) at android.app.Activity.performCreate(Activity