简体   繁体   中英

ListView Android crashes with Runtime exception

My List view seems to be crashing no matter what I do. Here is the code that passes a Bundle to a List handling activity NotificationList

Bundle extras= new Bundle();
Intent  intent= new Intent(Locations.this, NotificationList.class);
extras.putString("name0", "Robowars");
extras.putString("name1", "Robowa");

extras.putString("time0", "1:40");
extras.putString("time1", "1:30");

extras.putString("place0", "ekm");
extras.putString("place1", "ekm2");

extras.putString("id0","my id");
extras.putString("id1", "new id");

extras.putString("type0", "tech");
extras.putString("type1", "cult");

extras.putString("count", "1");
intent.putExtras(extras);
startActivity(intent);

And here is the code for my NotificationList :

public class NotificationList extends ActionBarActivity {

String listName[],listPlace[],listTime[],listId[],listType[];
ListView listview;
String count;


Intent intent;
@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub

    super.onCreate(savedInstanceState);
    setContentView(R.layout.culturallist);

    intent= getIntent();

      //  TypedArray listThumbnail;
        listview = (ListView) findViewById(R.id.list);


    count=intent.getExtras().getString("count");
    int n=Integer.parseInt(count);
    for (int  i=0;i<=n;++i)
    {
        listName[i]= intent.getExtras().getString("name"+String.valueOf(i));
        listPlace[i]=intent.getExtras().getString("place"+String.valueOf(i));
        listTime[i]=intent.getExtras().getString("time"+String.valueOf(i));    
        listId[i]=intent.getExtras().getString("id"+i);
        listType[i]=intent.getExtras().getString("type"+String.valueOf(i));

    //    Toast.makeText(NotificationList.this, listName[i], Toast.LENGTH_LONG).show();
    }

    listview.setAdapter(new NotifListAdapter(NotificationList.this,listName,listPlace,listTime,listType,listId));


    /*AsyncList list= new AsyncList();
    list.execute();*/

      listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int j, long l) {


            Intent intent= new Intent(NotificationList.this,CardActivity.class);
                Bundle extras= new Bundle();

                String id = ((TextView)findViewById(R.id.id)).toString();
                String type = ((TextView) findViewById(R.id.eventtype)).toString();

                extras.putString("key", id);
        extras.putString("eventtype", type);

                intent.putExtras(extras);
                startActivity(intent);
            }
        });
    }

}

And here is the custom adapter:

    class NotifFonts{
    private static Typeface typeFace;

    public static Typeface getTypeFace(Context mContext){

            if(typeFace==null)
            {
                typeFace = Typeface.createFromAsset(mContext.getAssets(), "fonts/robotolight.ttf");
            }

        return typeFace;
    }
}

class NotifListAdapter extends BaseAdapter {

    static class ViewHolder{
        TextView title,place,time,id,type;

    }

    private String[] listName,listId,listType,listPlace,listTime;

    private  Context context;

    private static LayoutInflater inflater = null;

    public NotifListAdapter(Context context,
            String[] listName, String[] listPlace, String[] listTime,
            String[] listType, String[] listId) {


        this.listId=listId;
        this.listName=listName;
        this.listPlace=listPlace;
        this.listTime=listTime;
        this.listType=listType;

        inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return listName.length;
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return listName[position];
    }


    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public View getView(int position, View vi, ViewGroup parent) {

        ViewHolder holder;
        if (vi == null) 

        {
            holder=new ViewHolder();
            vi = inflater.inflate(R.layout.list_row_notif,null);
         holder.title = (TextView) vi.findViewById(R.id.name); 
         holder.place=(TextView) vi.findViewById(R.id.place); 
         holder.time=(TextView) vi.findViewById(R.id.time); 
         holder.id=(TextView) vi.findViewById(R.id.id);
         holder.type=(TextView) vi.findViewById(R.id.eventtype);
    //     holder.thumbnail=(ImageView) vi.findViewById(R.id.list_image);  
            vi.setTag(holder);
        }
        else
        {
            holder=(ViewHolder) vi.getTag();
        }


     try {
        holder.title.setTypeface(NotifFonts.getTypeFace(context));
         holder.place.setTypeface(NotifFonts.getTypeFace(context));

     holder.title.setText(listName[position]);    
          //  holder.thumbnail.setImageResource(listThumbnail.getResourceId(position, -1));
     holder.time.setText(listTime[position]);
     holder.place.setText(listPlace[position]);
     holder.id.setText(listId[position]);
     holder.type.setText(listType[position]);
    } catch (Exception e) {

        e.printStackTrace();
    }

        return vi;
    }
}

Logcat says:

09-23 23:19:14.505: E/videowall-TranscodeService(23550): duration time is 0 ==> not Live but Static thumbnail
09-23 23:19:14.515: E/videowall-TranscodeService(23550): duration time is 11 ==> not Live but Static thumbnail
09-23 23:19:16.450: E/WifiHW(2327): ##################### set firmware type 0 #####################
09-23 23:19:18.020: E/LockPatternKeyguardView(2327): mIsVoiceUnlockOn=false
09-23 23:19:18.465: E/OMXCodec(1941): [OMX.google.vorbis.decoder] err = -1011
09-23 23:19:18.550: E/CircleShortcutWidget(2327): density = 320
09-23 23:19:18.550: E/CircleShortcutWidget(2327): pkg name =com.android.contacts, activityName=com.android.contacts.activities.DialtactsActivity
09-23 23:19:18.580: E/CircleShortcutWidget(2327): pkg name =com.google.android.googlequicksearchbox, activityName=com.google.android.googlequicksearchbox.SearchActivity
09-23 23:19:18.615: E/CircleShortcutWidget(2327): pkg name =com.android.browser, activityName=com.android.browser.BrowserActivity
09-23 23:19:18.630: E/OMXCodec(1941): [OMX.google.vorbis.decoder] err = -1011
09-23 23:19:18.645: E/CircleShortcutWidget(2327): pkg name =com.sec.android.app.camera, activityName=com.sec.android.app.camera.Camera
09-23 23:19:18.655: E/CircleShortcutWidget(2327): pkg name =com.android.mms, activityName=com.android.mms.ui.ConversationComposer
09-23 23:19:18.965: E/KeyguardViewMediator(2327): 2. Lockscreen lock
09-23 23:19:18.965: E/KeyguardViewMediator(2327): Phone is boot completed. so can broadcast
09-23 23:19:19.290: E/LockPatternKeyguardView(2327): !!! callback setLockScreenReady
09-23 23:19:19.290: E/CircleUnlockRippleRenderer(2327): CircleUnlockRippleRenderer setLockScreenReady
09-23 23:19:27.150: E/Watchdog(2327): !@Sync 950
09-23 23:19:43.130: E/MtpService(22037): In MTPAPP onReceive:android.intent.action.BATTERY_CHANGED
09-23 23:19:43.130: E/MtpService(22037): battPlugged Type : 2
09-23 23:19:43.230: E/Sensors(2327): Light old sensor_state 0, new sensor_state : 64 en : 1
09-23 23:19:43.400: E/Sensors(2327): Light old sensor_state 64, new sensor_state : 0 en : 0
09-23 23:19:53.085: E/Sensors(2327): Light old sensor_state 0, new sensor_state : 64 en : 1
09-23 23:19:53.090: E/Sensors(2327): Acc old sensor_state 64, new sensor_state : 65 en : 1
09-23 23:19:53.270: E/lights(2327): write_int failed to open /sys/class/leds/keyboard-backlight/brightness
09-23 23:19:53.530: E/SecTVOutService(1938): virtual void android::SecTVOutService::setHdmiStatus(uint32_t)::mSecHdmi.connect() fail
09-23 23:19:53.665: E/WifiHW(2327): ##################### set firmware type 0 #####################
09-23 23:19:53.690: E/ClockAlarmWidget(17819): [AlarmWidgetIdManager] getListItem() : itemIndex=0, widgetID:1
09-23 23:19:53.690: E/ClockAlarmWidget(17819): [AlarmWidgetIdManager] getListItem() : ItemIndex exceed ListItemCount. itemIndex=1
09-23 23:19:53.690: E/ClockAlarmWidget(17819): [AlarmWidgetIdManager] getListItem() : itemIndex=1, widgetID:1
09-23 23:19:53.715: E/videowall-TranscodeReceiver(23550): broadcastMSG : android.intent.action.SCREEN_ON
09-23 23:19:53.985: E/Launcher(3098): Error finding setting, default accessibility to not found: accessibility_enabled
09-23 23:19:54.000: E/KeyguardViewMediator(2327): 3. Lockscreen unlock
09-23 23:19:54.000: E/KeyguardViewMediator(2327): Phone is boot completed. so can broadcast
09-23 23:19:54.000: E/KeyguardViewMediator(2327): Phone is boot completed. so can broadcast
09-23 23:19:54.010: E/MotionRecognitionService(2327):   mReceiver.onReceive : ACTION_USER_PRESENT  :: UNLOCK SCREEN
09-23 23:19:54.100: E/SpannableStringBuilder(3098): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-23 23:19:54.100: E/SpannableStringBuilder(3098): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-23 23:19:54.105: E/MTPRx(22037): In MtpReceiverandroid.intent.action.USER_PRESENT
09-23 23:19:54.105: E/MTPRx(22037): check value of boot_completed is1
09-23 23:19:54.105: E/MTPRx(22037): check booting is completed_sys.boot_completed
09-23 23:19:54.120: E/MTPRx(22037): Sd-Card path/storage/extSdCard
09-23 23:19:54.135: E/MTPRx(22037): Status for mount/Unmount :mounted
09-23 23:19:54.135: E/MTPRx(22037): SDcard is  available
09-23 23:19:54.135: E/MTPRx(22037): The value of first_boot is  1
09-23 23:19:54.135: E/MTPRx(22037): [ 662] The value of first_boot is  1NORMAL SEQUENCE 
09-23 23:19:57.155: E/Watchdog(2327): !@Sync 951
09-23 23:20:00.115: E/ClockAlarmWidget(17819): [AlarmWidgetIdManager] getListItem() : itemIndex=0, widgetID:1
09-23 23:20:00.115: E/ClockAlarmWidget(17819): [AlarmWidgetIdManager] getListItem() : ItemIndex exceed ListItemCount. itemIndex=1
09-23 23:20:00.115: E/ClockAlarmWidget(17819): [AlarmWidgetIdManager] getListItem() : itemIndex=1, widgetID:1
09-23 23:20:04.340: E/SpannableStringBuilder(23766): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-23 23:20:04.340: E/SpannableStringBuilder(23766): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-23 23:20:05.035: E/AndroidRuntime(23766): FATAL EXCEPTION: main
09-23 23:20:05.035: E/AndroidRuntime(23766): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.oxtro.igniz/com.oxtro.igniz.NotificationList}: java.lang.NullPointerException
09-23 23:20:05.035: E/AndroidRuntime(23766):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
09-23 23:20:05.035: E/AndroidRuntime(23766):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
09-23 23:20:05.035: E/AndroidRuntime(23766):    at android.app.ActivityThread.access$600(ActivityThread.java:140)
09-23 23:20:05.035: E/AndroidRuntime(23766):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
09-23 23:20:05.035: E/AndroidRuntime(23766):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-23 23:20:05.035: E/AndroidRuntime(23766):    at android.os.Looper.loop(Looper.java:137)
09-23 23:20:05.035: E/AndroidRuntime(23766):    at android.app.ActivityThread.main(ActivityThread.java:4898)
09-23 23:20:05.035: E/AndroidRuntime(23766):    at java.lang.reflect.Method.invokeNative(Native Method)
09-23 23:20:05.035: E/AndroidRuntime(23766):    at java.lang.reflect.Method.invoke(Method.java:511)
09-23 23:20:05.035: E/AndroidRuntime(23766):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
09-23 23:20:05.035: E/AndroidRuntime(23766):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
09-23 23:20:05.035: E/AndroidRuntime(23766):    at dalvik.system.NativeStart.main(Native Method)
09-23 23:20:05.035: E/AndroidRuntime(23766): Caused by: java.lang.NullPointerException
09-23 23:20:05.035: E/AndroidRuntime(23766):    at com.oxtro.igniz.NotificationList.onCreate(NotificationList.java:48)
09-23 23:20:05.035: E/AndroidRuntime(23766):    at android.app.Activity.performCreate(Activity.java:5206)
09-23 23:20:05.035: E/AndroidRuntime(23766):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
09-23 23:20:05.035: E/AndroidRuntime(23766):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
09-23 23:20:05.035: E/AndroidRuntime(23766):    ... 11 more
09-23 23:20:05.040: E/android.os.Debug(2327): !@Dumpstate > dumpstate -k -t -z -d -o /data/log/dumpstate_app_error
09-23 23:20:13.965: E/WifiHW(2327): ##################### set firmware type 0 #####################
09-23 23:20:13.970: E/MtpService(22037): In MTPAPP onReceive:android.intent.action.BATTERY_CHANGED
09-23 23:20:13.975: E/MtpService(22037): battPlugged Type : 2
09-23 23:20:14.905: E/InputDispatcher(2327): channel ~ Channel is unrecoverably broken and will be disposed!
09-23 23:20:14.985: E/Launcher(3098): Error finding setting, default accessibility to not found: accessibility_enabled
09-23 23:20:15.910: E/SpannableStringBuilder(3098): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-23 23:20:15.910: E/SpannableStringBuilder(3098): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-23 23:20:16.335: E/WifiHW(2327): ##################### set firmware type 0 #####################
09-23 23:20:27.160: E/Watchdog(2327): !@Sync 952
09-23 23:20:30.750: A/PowerManager(21999): WakeLock finalized while still held: TapContextSDK
09-23 23:20:30.750: A/PowerManager(21999): WakeLock finalized while still held: TapContextSDK
09-23 23:20:30.755: A/PowerManager(21999): WakeLock finalized while still held: TapContextSDK
09-23 23:20:30.760: A/PowerManager(21999): WakeLock finalized while still held: TapContextSDK
09-23 23:20:30.760: A/PowerManager(21999): WakeLock finalized while still held: TapContextSDK
09-23 23:20:30.765: A/PowerManager(21999): WakeLock finalized while still held: TapContextSDK
09-23 23:20:31.075: E/com.salyangoz.rgbtohexconverter$TapContextSDK(21999): Failed to register. Status Code: 400
09-23 23:20:32.610: E/SensorManager(3242): thread start
09-23 23:20:33.050: E/SpannableStringBuilder(24621): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-23 23:20:33.050: E/SpannableStringBuilder(24621): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-23 23:20:33.630: E/AndroidRuntime(24621): FATAL EXCEPTION: main
09-23 23:20:33.630: E/AndroidRuntime(24621): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.oxtro.igniz/com.oxtro.igniz.NotificationList}: java.lang.NullPointerException
09-23 23:20:33.630: E/AndroidRuntime(24621):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
09-23 23:20:33.630: E/AndroidRuntime(24621):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
09-23 23:20:33.630: E/AndroidRuntime(24621):    at android.app.ActivityThread.access$600(ActivityThread.java:140)
09-23 23:20:33.630: E/AndroidRuntime(24621):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
09-23 23:20:33.630: E/AndroidRuntime(24621):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-23 23:20:33.630: E/AndroidRuntime(24621):    at android.os.Looper.loop(Looper.java:137)
09-23 23:20:33.630: E/AndroidRuntime(24621):    at android.app.ActivityThread.main(ActivityThread.java:4898)
09-23 23:20:33.630: E/AndroidRuntime(24621):    at java.lang.reflect.Method.invokeNative(Native Method)
09-23 23:20:33.630: E/AndroidRuntime(24621):    at java.lang.reflect.Method.invoke(Method.java:511)
09-23 23:20:33.630: E/AndroidRuntime(24621):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
09-23 23:20:33.630: E/AndroidRuntime(24621):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
09-23 23:20:33.630: E/AndroidRuntime(24621):    at dalvik.system.NativeStart.main(Native Method)
09-23 23:20:33.630: E/AndroidRuntime(24621): Caused by: java.lang.NullPointerException
09-23 23:20:33.630: E/AndroidRuntime(24621):    at com.oxtro.igniz.NotificationList.onCreate(NotificationList.java:48)
09-23 23:20:33.630: E/AndroidRuntime(24621):    at android.app.Activity.performCreate(Activity.java:5206)
09-23 23:20:33.630: E/AndroidRuntime(24621):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
09-23 23:20:33.630: E/AndroidRuntime(24621):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
09-23 23:20:33.630: E/AndroidRuntime(24621):    ... 11 more
09-23 23:20:33.635: E/android.os.Debug(2327): !@Dumpstate > dumpstate -k -t -z -d -o /data/log/dumpstate_app_error
09-23 23:20:43.975: E/MtpService(22037): In MTPAPP onReceive:android.intent.action.BATTERY_CHANGED
09-23 23:20:43.975: E/MtpService(22037): battPlugged Type : 2
09-23 23:20:44.180: E/Launcher(3098): Error finding setting, default accessibility to not found: accessibility_enabled
09-23 23:20:54.900: E/SpannableStringBuilder(3098): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-23 23:20:54.900: E/SpannableStringBuilder(3098): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-23 23:20:57.165: E/Watchdog(2327): !@Sync 953
09-23 23:21:00.055: E/ClockAlarmWidget(17819): [AlarmWidgetIdManager] getListItem() : itemIndex=0, widgetID:1
09-23 23:21:00.055: E/ClockAlarmWidget(17819): [AlarmWidgetIdManager] getListItem() : ItemIndex exceed ListItemCount. itemIndex=1
09-23 23:21:00.055: E/ClockAlarmWidget(17819): [AlarmWidgetIdManager] getListItem() : itemIndex=1, widgetID:1
09-23 23:21:04.515: E/SpannableStringBuilder(25582): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-23 23:21:04.515: E/SpannableStringBuilder(25582): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-23 23:21:05.185: E/AndroidRuntime(25582): FATAL EXCEPTION: main
09-23 23:21:05.185: E/AndroidRuntime(25582): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.oxtro.igniz/com.oxtro.igniz.NotificationList}: java.lang.NullPointerException
09-23 23:21:05.185: E/AndroidRuntime(25582):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
09-23 23:21:05.185: E/AndroidRuntime(25582):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
09-23 23:21:05.185: E/AndroidRuntime(25582):    at android.app.ActivityThread.access$600(ActivityThread.java:140)
09-23 23:21:05.185: E/AndroidRuntime(25582):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
09-23 23:21:05.185: E/AndroidRuntime(25582):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-23 23:21:05.185: E/AndroidRuntime(25582):    at android.os.Looper.loop(Looper.java:137)
09-23 23:21:05.185: E/AndroidRuntime(25582):    at android.app.ActivityThread.main(ActivityThread.java:4898)
09-23 23:21:05.185: E/AndroidRuntime(25582):    at java.lang.reflect.Method.invokeNative(Native Method)
09-23 23:21:05.185: E/AndroidRuntime(25582):    at java.lang.reflect.Method.invoke(Method.java:511)
09-23 23:21:05.185: E/AndroidRuntime(25582):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
09-23 23:21:05.185: E/AndroidRuntime(25582):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
09-23 23:21:05.185: E/AndroidRuntime(25582):    at dalvik.system.NativeStart.main(Native Method)
09-23 23:21:05.185: E/AndroidRuntime(25582): Caused by: java.lang.NullPointerException
09-23 23:21:05.185: E/AndroidRuntime(25582):    at com.oxtro.igniz.NotificationList.onCreate(NotificationList.java:48)
09-23 23:21:05.185: E/AndroidRuntime(25582):    at android.app.Activity.performCreate(Activity.java:5206)
09-23 23:21:05.185: E/AndroidRuntime(25582):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
09-23 23:21:05.185: E/AndroidRuntime(25582):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
09-23 23:21:05.185: E/AndroidRuntime(25582):    ... 11 more
09-23 23:21:05.195: E/android.os.Debug(2327): !@Dumpstate > dumpstate -k -t -z -d -o /data/log/dumpstate_app_error
09-23 23:21:13.980: E/WifiHW(2327): ##################### set firmware type 0 #####################
09-23 23:21:16.345: E/WifiHW(2327): ##################### set firmware type 0 #####################
09-23 23:21:20.060: E/MtpService(22037): In MTPAPP onReceive:android.intent.action.BATTERY_CHANGED
09-23 23:21:20.060: E/MtpService(22037): battPlugged Type : 2

if i am not wrong then you have not initialize your string arrays

please initialize your string[] as

int n=Integer.parseInt(count);
listname=new String[n];
listplace=new String[n];

and so on for all arrays

for (int  i=0;i<=n;++i)
{
....

Your activity cannot be started/initialised, that is what your Logcat is saying. Therefore, I would make sure that every single Activity is defined in the Manifest.xml as that could be your root cause.

What about changing protected void onCreate() to public void onCreate()

Try this one,

Intent  intent= new Intent(Locations.this, NotificationList.class);
intent.putString("name0", "Robowars");
intent.putString("name1", "Robowa");

intent.putString("time0", "1:40");
intent.putString("time1", "1:30");

intent.putString("place0", "ekm");
intent.putString("place1", "ekm2");

intent.putString("id0","my id");
intent.putString("id1", "new id");

intent.putString("type0", "tech");
intent.putString("type1", "cult");

intent.putString("count", "1");

startActivity(intent);

If you really want to use Bundle to pass data. Read the thread below it will help you.

Passing a Bundle on startActivity()?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM